微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

javax.persistence.Version的实例源码

项目:crnk-framework    文件JpaResourceField@R_147_404[email protected]   
@Override
public Optional<Boolean> isPostable(BeanAttribute@R_147_4045@ion attributeDesc) {
    Optional<Column> column = attributeDesc.getAnnotation(Column.class);
    Optional<Version> version = attributeDesc.getAnnotation(Version.class);
    if (!version.isPresent() && column.isPresent()) {
        return Optional.of(column.get().insertable());
    }
    Optional<GeneratedValue> generatedValue = attributeDesc.getAnnotation(GeneratedValue.class);
    if (generatedValue.isPresent()) {
        return Optional.of(false);
    }
    return Optional.empty();
}
项目:crnk-framework    文件JpaResourceField@R_147_404[email protected]   
@Override
public Optional<Boolean> isPatchable(BeanAttribute@R_147_4045@ion attributeDesc) {
    Optional<Column> column = attributeDesc.getAnnotation(Column.class);
    Optional<Version> version = attributeDesc.getAnnotation(Version.class);
    if (!version.isPresent() && column.isPresent()) {
        return Optional.of(column.get().updatable());
    }
    Optional<GeneratedValue> generatedValue = attributeDesc.getAnnotation(GeneratedValue.class);
    if (generatedValue.isPresent()) {
        return Optional.of(false);
    }
    return Optional.empty();
}
项目:cibet    文件EntityIntrospector.java   
private boolean include(Class<?> type,PropertyDescriptor descriptor) {
   Field field = findField(type,descriptor.getName());
   if (field == null) {
      return false;
   }
   if (hasAnnotation(Version.class,descriptor.getReadMethod(),field)) {
      return false;
   }
   if (hasAnnotation(Transient.class,field)) {
      return false;
   }
   if (Modifier.isstatic(field.getModifiers())) {
      return false;
   }
   if (Modifier.isTransient(field.getModifiers())) {
      return false;
   }
   return true;
}
项目:org.fastnate    文件EntityClass.java   
/**
 * Builds the property for the given attribute.
 *
 * @param attribute
 *            the attribute to inspect
 * @param columnMetadata
 *            the attached (or overriden) column Metadata
 * @param override
 *            the AssociationOverride found for this attribute
 * @return the property that represents the attribute or {@code null} if not persistent
 */
<X> Property<X,?> buildProperty(final AttributeAccessor attribute,final Column columnMetadata,final AssociationOverride override) {
    if (attribute.isPersistent()) {
        if (CollectionProperty.isCollectionProperty(attribute)) {
            return new CollectionProperty<>(this,attribute,override);
        } else if (MapProperty.isMapProperty(attribute)) {
            return new MapProperty<>(this,override);
        } else if (EntityProperty.isEntityProperty(attribute)) {
            return new EntityProperty<>(this.context,getTable(),override);
        } else if (attribute.isAnnotationPresent(Embedded.class)) {
            return new EmbeddedProperty<>(this,attribute);
        } else if (attribute.isAnnotationPresent(Version.class)) {
            return new VersionProperty<>(this.context,this.table,columnMetadata);
        } else {
            return new PrimitiveProperty<>(this.context,columnMetadata);
        }
    }
    return null;
}
项目:@R_364_3270@    文件EntityUtils.java   
public static Property<Serializable> getVersionProperty(Class<?> entityClass)
{
    List<PropertyCriteria> criteriaList = new LinkedList<PropertyCriteria>();
    criteriaList.add(new AnnotatedPropertyCriteria(Version.class));

    String fromMappingFiles = PersistenceUnitDescriptorProvider.getInstance().versionField(entityClass);
    if (fromMappingFiles != null)
    {
        criteriaList.add(new NamedPropertyCriteria(fromMappingFiles));
    }

    for (PropertyCriteria criteria : criteriaList)
    {
        PropertyQuery<Serializable> query =
            PropertyQueries.<Serializable> createquery(entityClass).addCriteria(criteria);
        Property<Serializable> result = query.getFirstResult();
        if (result != null)
        {
            return result;
        }
    }

    return null;
}
项目:randomito-all    文件NullifyIdVersionPostProcessor.java   
@Override
public Object process(AnnotationInfo ctx,Object value) {
    if (ctx.isAnnotationPresent(Id.class)
            || ctx.isAnnotationPresent(Version.class)) {
        return null;
    }
    return value;
}
项目:easy-mybatis    文件ModelUtils.java   
public static String getRecVersionFieldName(Class<? extends BaseMybatisModel> modelClass) {
    for (Method method : modelClass.getmethods()) {
        String methodName = method.getName();
        if (method.isAnnotationPresent(Version.class)) {
            return methodName.substring(3,4).toLowerCase() + methodName.substring(4);
        }
    }
    return null;
}
项目:easy-mybatis    文件ModelUtils.java   
public static String getRecVersionColumnName(Class<? extends BaseMybatisModel> modelClass) throws InvocationTargetException,illegalaccessexception,NoSuchMethodException {
    for (Method method : modelClass.getmethods()) {
        if (method.isAnnotationPresent(Version.class)) {
            for (int i = 0; i < method.getAnnotations().length; i++) {
                Annotation annotation = method.getAnnotations()[i];
                if (annotation.annotationType().equals(Column.class)) {
                    Method annotationMethod = annotation.getClass().getDeclaredMethod("name",method.getParameterTypes());
                    return annotationMethod.invoke(annotation,null).toString();
                }
            }
        }
    }
    return null;
}
项目:katharsis-framework    文件AbstractEntityMetaProvider.java   
private boolean hasJpaAnnotations(MetaAttribute attribute) {
    List<Class<? extends Annotation>> annotationClasses = Arrays.asList(Id.class,EmbeddedId.class,Column.class,ManyToMany.class,ManyToOne.class,OnetoMany.class,OnetoOne.class,Version.class,ElementCollection.class);
    for (Class<? extends Annotation> annotationClass : annotationClasses) {
        if (attribute.getAnnotation(annotationClass) != null) {
            return true;
        }
    }
    return false;
}
项目:oval    文件JPAAnnotationsConfigurer.java   
protected void initializeChecks(final Column annotation,final Collection<Check> checks,final AccessibleObject fieldOrMethod) {
    /* If the value is generated (annotated with @GeneratedValue) it is allowed to be null
     * before the entity has been persisted,same is true in case of optimistic locking
     * when a field is annotated with @Version.
     * Therefore and because of the fact that there is no generic way to determine if an entity
     * has been persisted already,a not-null check will not be performed for such fields.
     */
    if (!annotation.nullable() && !fieldOrMethod.isAnnotationPresent(GeneratedValue.class) && !fieldOrMethod.isAnnotationPresent(Version.class)
            && !fieldOrMethod.isAnnotationPresent(NotNull.class))
        if (!containsCheckOfType(checks,NotNullCheck.class))
            checks.add(new NotNullCheck());

    // add Length check based on Column.length parameter,but only:
    if (!fieldOrMethod.isAnnotationPresent(Lob.class) && // if @Lob is not present
            !fieldOrMethod.isAnnotationPresent(Enumerated.class) && // if @Enumerated is not present
            !fieldOrMethod.isAnnotationPresent(Length.class) // if an explicit @Length constraint is not present
    ) {
        final LengthCheck lengthCheck = new LengthCheck();
        lengthCheck.setMax(annotation.length());
        checks.add(lengthCheck);
    }

    // add Range check based on Column.precision/scale parameters,but only:
    if (!fieldOrMethod.isAnnotationPresent(Range.class) // if an explicit @Range is not present
            && annotation.precision() > 0 // if precision is > 0
            && Number.class.isAssignableFrom(fieldOrMethod instanceof Field ? ((Field) fieldOrMethod).getType() : ((Method) fieldOrMethod).getReturnType()) // if numeric field type
    ) {
        /* precision = 6,scale = 2  => -9999.99<=x<=9999.99
         * precision = 4,scale = 1  =>   -999.9<=x<=999.9
         */
        final RangeCheck rangeCheck = new RangeCheck();
        rangeCheck.setMax(Math.pow(10,annotation.precision() - annotation.scale()) - Math.pow(0.1,annotation.scale()));
        rangeCheck.setMin(-1 * rangeCheck.getMax());
        checks.add(rangeCheck);
    }
}
项目:greenpepper    文件AbstractEntity.java   
/**
 * <p>Getter for the field <code>version</code>.</p>
 *
 * @return a {@link java.lang.Integer} object.
 */
@Version
@Column(name="VERSION")
public Integer getVersion()
{
    return this.version;
}
项目:greenpepper    文件AbstractVersionedEntity.java   
/**
 * <p>Getter for the field <code>version</code>.</p>
 *
 * @return a {@link java.lang.Integer} object.
 */
@Version
@Column(name="VERSION")
public Integer getVersion()
{
    return this.version;
}
项目:sdcct    文件SdcctResourceImpl.java   
@Column(name = DbColumnNames.ENTITY_VERSION)
@Nullable
@Override
@Version
public Long getEntityVersion() {
    return this.entityVersion;
}
项目:persistence    文件AbstractJpaEntity.java   
/**
 * {@inheritDoc}
 */
@Override
@Version
@Column(name = "version")
public int getModificationCounter() {

  return super.getModificationCounter();
}
项目:screensaver    文件AttachedFile.java   
/**
 * Get the version for the attached file.
 * @return the version for the attached file
 * @motivation for hibernate
 */
@Column(nullable=false)
@Version
private Integer getVersion()
{
  return _version;
}
项目:screensaver    文件LibraryContentsversion.java   
/**
 * @motivation for hibernate
 */
@Version
@Column(nullable = false)
private Integer getVersion()
{
  return _version;
}
项目:screensaver    文件WellVolumeAdjustment.java   
/**
 * Get the version.
 * @return the version
 * @motivation for hibernate
 */
@Column(nullable=false)
@Version
private Integer getVersion()
{
  return _version;
}
项目:screensaver    文件Library.java   
/**
 * Get the version for the screening library.
 *
 * @return the version for the screening library
 * @motivation for hibernate
 */
@Version
@Column(nullable = false)
private Integer getVersion()
{
  return _version;
}
项目:screensaver    文件copy.java   
/**
 * Get the version for the copy.
 * @return the version for the copy
 * @motivation for hibernate
 */
@Version
@Column(nullable=false)
private Integer getVersion()
{
  return _version;
}
项目:screensaver    文件Well.java   
/**
 * @motivation for hibernate
 */
@Version
@Column(nullable=false)
private Integer getVersion()
{
  return _version;
}
项目:screensaver    文件Activity.java   
/**
 * Get the version for the activity.
 * @return the version for the activity
 * @motivation for hibernate
 */
@Column(nullable=false)
@Version
private Integer getVersion()
{
  return _version;
}
项目:screensaver    文件AnnotationType.java   
/**
 * Get the version for the annotation type.
 * @return the version for the annotation type
 * @motivation for hibernate
 */
@Column(nullable=false)
@Version
private Integer getVersion()
{
  return _version;
}
项目:screensaver    文件ScreenResult.java   
/**
 * Get the version number of the screen result.
 * @return the version number of the screen result
 * @motivation for hibernate
 */
@Column(nullable=false)
@Version
private Integer getVersion()
{
  return _version;
}
项目:screensaver    文件AssayWell.java   
/**
 * Get the version number of the screen result.
 * @return the version number of the screen result
 * @motivation for hibernate
 */
@Column(nullable=false)
@Version
private Integer getVersion()
{
  return _version;
}
项目:screensaver    文件DataColumn.java   
/**
 * @motivation for hibernate
 */
@Column(nullable=false)
@Version
private Integer getVersion()
{
  return _version;
}
项目:screensaver    文件AssayPlate.java   
/**
 * @motivation for hibernate
 */
@Column(nullable=false)
@Version
private Integer getVersion()
{
  return _version;
}
项目:screensaver    文件ScreensaverUser.java   
/**
 * Get the version for the Screensaver user.
 * @return the version for the Screensaver user
 * @motivation for hibernate
 */
@Version
@Column(nullable=false)
private Integer getVersion()
{
  return _version;
}
项目:screensaver    文件ChecklistItem.java   
/**
 * @motivation for hibernate
 */
@Version
@Column(nullable = false)
private Integer getVersion()
{
  return _version;
}
项目:screensaver    文件CherryPickAssayPlate.java   
/**
 * Get the version for the cherry pick request.
 * @return the version for the cherry pick request
 * @motivation for hibernate
 */
@Column(nullable=false)
@Version
private Integer getVersion()
{
  return _version;
}
项目:screensaver    文件CherryPickRequest.java   
/**
 * Get the version for the cherry pick request.
 * @return the version for the cherry pick request
 * @motivation for hibernate
 */
@Column(nullable=false)
@Version
private Integer getVersion()
{
  return _version;
}
项目:screensaver    文件LabCherryPick.java   
/**
 * Get the version for the lab cherry pick.
 * @return the version for the lab cherry pick
 * @motivation for hibernate
 */
@Column(nullable=false)
@Version
private Integer getVersion()
{
  return _version;
}
项目:screensaver    文件ScreenerCherryPick.java   
/**
 * Get the version for the screener cherry pick.
 * @return the version for the screener cherry pick
 * @motivation for hibernate
 */
@Column(nullable=false)
@Version
private Integer getVersion()
{
  return _version;
}
项目:screensaver    文件Screen.java   
/**
 * Get the version for the screen.
 * @return the version for the screen
 * @motivation for hibernate
 */
@Version
@Column(nullable=false)
private Integer getVersion()
{
  return _version;
}
项目:screensaver    文件EquipmentUsed.java   
/**
 * @motivation for hibernate
 */
@Column(nullable=false)
@Version
private Integer getVersion()
{
  return _version;
}
项目:screensaver    文件Publication.java   
/**
 * @motivation for hibernate
 */
@Column(nullable=false)
@Version
private Integer getVersion()
{
  return _version;
}
项目:panifex-platform    文件AbstractEntity.java   
/**
 * {@inheritDoc}
 */
@Column(name = "optlock_version")
@Version
@Override
public int getoptlockVersion() {
    return optlockVersion;
}
项目:stroom-stats    文件BaseEntity.java   
@Version
@Column(name = VERSION,columnDeFinition = tinyint_UNSIGNED,nullable = false)
@XmlTransient
public byte getVersion() {
    return version;
}
项目:plumdo-work    文件BaseEntity.java   
@Version
@Column(name = "REV_")
public Integer getRev() {
    return rev;
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。