public Property makeProperty() {
validateMake();
LOG.debugf( "Building property %s", name );
Property prop = new Property();
prop.setName( name );
prop.setNodeName( name );
prop.setValue( value );
prop.setLazy( lazy );
prop.setCascade( cascade );
prop.setPropertyAccessorName( accessType.getType() );
if ( property != null ) {
prop.setValueGenerationStrategy( determineValueGenerationStrategy( property ) );
}
NaturalId naturalId = property != null ? property.getAnnotation( NaturalId.class ) : null;
if ( naturalId != null ) {
if ( ! entityBinder.isRootEntity() ) {
throw new AnnotationException( "@NaturalId only valid on root entity (or its @MappedSuperclasses)" );
}
if ( ! naturalId.mutable() ) {
updatable = false;
}
prop.setNaturalIdentifier( true );
}
// HHH-4635 -- needed for dialect-specific property ordering
Lob lob = property != null ? property.getAnnotation( Lob.class ) : null;
prop.setLob( lob != null );
prop.setInsertable( insertable );
prop.setUpdateable( updatable );
// this is already handled for collections in CollectionBinder...
if ( Collection.class.isInstance( value ) ) {
prop.setOptimisticLocked( ( (Collection) value ).isOptimisticLocked() );
}
else {
final OptimisticLock lockAnn = property != null
? property.getAnnotation( OptimisticLock.class )
: null;
if ( lockAnn != null ) {
//TODO this should go to the core as a mapping validation checking
if ( lockAnn.excluded() && (
property.isAnnotationPresent( javax.persistence.Version.class )
|| property.isAnnotationPresent( Id.class )
|| property.isAnnotationPresent( EmbeddedId.class ) ) ) {
throw new AnnotationException(
"@OptimisticLock.exclude=true incompatible with @Id, @EmbeddedId and @Version: "
+ StringHelper.qualify( holder.getPath(), name )
);
}
}
final boolean isOwnedValue = !isToOneValue( value ) || insertable; // && updatable as well???
final boolean includeInOptimisticLockChecks = ( lockAnn != null )
? ! lockAnn.excluded()
: isOwnedValue;
prop.setOptimisticLocked( includeInOptimisticLockChecks );
}
LOG.tracev( "Cascading {0} with {1}", name, cascade );
this.mappingProperty = prop;
return prop;
}
java类org.hibernate.annotations.NaturalId的实例源码
PropertyBinder.java 文件源码
项目:lams
阅读 43
收藏 0
点赞 0
评论 0
AnnotatedEntity.java 文件源码
项目:hazelcast-hibernate5
阅读 43
收藏 0
点赞 0
评论 0
@NaturalId(mutable = true)
public String getTitle() {
return title;
}
AnnotatedEntity.java 文件源码
项目:hazelcast-hibernate
阅读 36
收藏 0
点赞 0
评论 0
@NaturalId(mutable = true)
public String getTitle() {
return title;
}
BaseData.java 文件源码
项目:eMonocot
阅读 55
收藏 0
点赞 0
评论 0
/**
*
* @return The unique identifier of the object
*/
@NaturalId
@NotEmpty
public String getIdentifier() {
return identifier;
}
Principal.java 文件源码
项目:eMonocot
阅读 42
收藏 0
点赞 0
评论 0
/**
*
* @return The unique identifier of the object
*/
@NaturalId
@NotEmpty
public String getIdentifier() {
return identifier;
}
Resource.java 文件源码
项目:eMonocot
阅读 39
收藏 0
点赞 0
评论 0
/**
*
* @return The unique identifier of the object
*/
@NaturalId
@NotEmpty
public String getIdentifier() {
return identifier;
}
BaseData.java 文件源码
项目:powop
阅读 41
收藏 0
点赞 0
评论 0
/**
*
* @return The unique identifier of the object
*/
@NaturalId
@NotEmpty
public String getIdentifier() {
return identifier;
}
HibernateL2CacheSelfTest.java 文件源码
项目:ignite
阅读 34
收藏 0
点赞 0
评论 0
/**
* @return Name.
*/
@NaturalId(mutable = true)
public String getName() {
return name;
}
HibernateL2CacheSelfTest.java 文件源码
项目:ignite
阅读 41
收藏 0
点赞 0
评论 0
/**
* @return Name.
*/
@NaturalId(mutable = true)
public String getName() {
return name;
}
HibernateL2CacheSelfTest.java 文件源码
项目:ignite
阅读 42
收藏 0
点赞 0
评论 0
/**
* @return Name.
*/
@NaturalId(mutable = true)
public String getName() {
return name;
}
HibernateL2CacheSelfTest.java 文件源码
项目:ignite
阅读 44
收藏 0
点赞 0
评论 0
/**
* @return Name.
*/
@NaturalId(mutable = true)
public String getName() {
return name;
}
FeatureValuePair.java 文件源码
项目:rainbownlp
阅读 41
收藏 0
点赞 0
评论 0
@NaturalId
public String getFeatureName() {
return featureName;
}
FeatureValuePair.java 文件源码
项目:rainbownlp
阅读 35
收藏 0
点赞 0
评论 0
@NaturalId
public String getFeatureValue() {
return featureValue;
}
FeatureValuePair.java 文件源码
项目:rainbownlp
阅读 39
收藏 0
点赞 0
评论 0
@NaturalId
public String getFeatureValueAuxiliary() {
return featureValueAuxiliary;
}
UserEntity.java 文件源码
项目:stdlib
阅读 56
收藏 0
点赞 0
评论 0
@NaturalId(mutable = true)
@Column(length = 200, nullable = false)
public String getEmail()
{
return email;
}
GetClassCar.java 文件源码
项目:yeoman-programmer
阅读 35
收藏 0
点赞 0
评论 0
@NaturalId
@NotNull
public String getVin() {
return vin;
}
Car.java 文件源码
项目:yeoman-programmer
阅读 33
收藏 0
点赞 0
评论 0
@NaturalId
@NotNull
public String getVin() {
return vin;
}
BrokenEqualsCar.java 文件源码
项目:yeoman-programmer
阅读 41
收藏 0
点赞 0
评论 0
@NaturalId
@NotNull
public String getVin() {
return vin;
}