當前位置: 首頁>>代碼示例>>Java>>正文


Java NaturalId類代碼示例

本文整理匯總了Java中org.hibernate.annotations.NaturalId的典型用法代碼示例。如果您正苦於以下問題:Java NaturalId類的具體用法?Java NaturalId怎麽用?Java NaturalId使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


NaturalId類屬於org.hibernate.annotations包,在下文中一共展示了NaturalId類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: makeProperty

import org.hibernate.annotations.NaturalId; //導入依賴的package包/類
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;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:65,代碼來源:PropertyBinder.java

示例2: getTitle

import org.hibernate.annotations.NaturalId; //導入依賴的package包/類
@NaturalId(mutable = true)
public String getTitle() {
    return title;
}
 
開發者ID:hazelcast,項目名稱:hazelcast-hibernate5,代碼行數:5,代碼來源:AnnotatedEntity.java

示例3: getIdentifier

import org.hibernate.annotations.NaturalId; //導入依賴的package包/類
/**
 *
 * @return The unique identifier of the object
 */
@NaturalId
@NotEmpty
public String getIdentifier() {
	return identifier;
}
 
開發者ID:RBGKew,項目名稱:eMonocot,代碼行數:10,代碼來源:BaseData.java

示例4: getName

import org.hibernate.annotations.NaturalId; //導入依賴的package包/類
/**
 * @return Name.
 */
@NaturalId(mutable = true)
public String getName() {
    return name;
}
 
開發者ID:apache,項目名稱:ignite,代碼行數:8,代碼來源:HibernateL2CacheSelfTest.java

示例5: getFeatureName

import org.hibernate.annotations.NaturalId; //導入依賴的package包/類
@NaturalId
public String getFeatureName() {
	return featureName;
}
 
開發者ID:ehsane,項目名稱:rainbownlp,代碼行數:5,代碼來源:FeatureValuePair.java

示例6: getFeatureValue

import org.hibernate.annotations.NaturalId; //導入依賴的package包/類
@NaturalId
public String getFeatureValue() {
	return featureValue;
}
 
開發者ID:ehsane,項目名稱:rainbownlp,代碼行數:5,代碼來源:FeatureValuePair.java

示例7: getFeatureValueAuxiliary

import org.hibernate.annotations.NaturalId; //導入依賴的package包/類
@NaturalId
public String getFeatureValueAuxiliary() {
	return featureValueAuxiliary;
}
 
開發者ID:ehsane,項目名稱:rainbownlp,代碼行數:5,代碼來源:FeatureValuePair.java

示例8: getEmail

import org.hibernate.annotations.NaturalId; //導入依賴的package包/類
@NaturalId(mutable = true)
@Column(length = 200, nullable = false)
public String getEmail()
{
	return email;
}
 
開發者ID:petergeneric,項目名稱:stdlib,代碼行數:7,代碼來源:UserEntity.java

示例9: getVin

import org.hibernate.annotations.NaturalId; //導入依賴的package包/類
@NaturalId
@NotNull
public String getVin() {
  return vin;
}
 
開發者ID:snd297,項目名稱:yeoman-programmer,代碼行數:6,代碼來源:GetClassCar.java


注:本文中的org.hibernate.annotations.NaturalId類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。