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


Java GenerationType類代碼示例

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


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

示例1: getId

import javax.persistence.GenerationType; //導入依賴的package包/類
@Id @GeneratedValue(strategy = GenerationType.TABLE, generator = "dog")
@TableGenerator(
	name = "dog",
	table = "sequences",
	pkColumnName = "key",
	pkColumnValue = "dog",
	valueColumnName = "seed"
)
public Long getId() { return id; }
 
開發者ID:hibernate,項目名稱:hibernate-ogm-redis,代碼行數:10,代碼來源:Dog.java

示例2: generationTypeToGeneratorStrategyName

import javax.persistence.GenerationType; //導入依賴的package包/類
public static String generationTypeToGeneratorStrategyName(GenerationType generatorEnum, boolean useNewGeneratorMappings) {
	switch ( generatorEnum ) {
		case IDENTITY:
			return "identity";
		case AUTO:
			return useNewGeneratorMappings
					? "enhanced-sequence"
					: "native";
		case TABLE:
			return useNewGeneratorMappings
					? "enhanced-table"
					: MultipleHiLoPerTableGenerator.class.getName();
		case SEQUENCE:
			return useNewGeneratorMappings
					? "enhanced-sequence"
					: "seqhilo";
	}
	throw new AssertionFailure( "Unknown GeneratorType: " + generatorEnum );
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:20,代碼來源:EnumConversionHelper.java

示例3: getId

import javax.persistence.GenerationType; //導入依賴的package包/類
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = COLUMN_NAME__ID)
public long getId() {
    if (idProperty == null) {
        return _id;
    } else {
        return idProperty.get();
    }
}
 
開發者ID:Naoghuman,項目名稱:Incubator,代碼行數:11,代碼來源:CategoryModel.java

示例4: getId

import javax.persistence.GenerationType; //導入依賴的package包/類
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "srva_event_id", nullable = false)
@Access(value = AccessType.PROPERTY)
@Override
public Long getId() {
    return id;
}
 
開發者ID:suomenriistakeskus,項目名稱:oma-riista-web,代碼行數:9,代碼來源:SrvaEvent.java

示例5: getId

import javax.persistence.GenerationType; //導入依賴的package包/類
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(nullable = false)
@Access(value = AccessType.PROPERTY)
@Override
public Long getId() {
    return id;
}
 
開發者ID:suomenriistakeskus,項目名稱:oma-riista-web,代碼行數:9,代碼來源:ObservationContextSensitiveFields.java

示例6: getId

import javax.persistence.GenerationType; //導入依賴的package包/類
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = ID, columnDefinition = NORMAL_KEY_DEF)
@XmlTransient
@Override
public long getId() {
    return id;
}
 
開發者ID:gchq,項目名稱:stroom-stats,代碼行數:9,代碼來源:BaseEntitySmall.java

示例7: getId

import javax.persistence.GenerationType; //導入依賴的package包/類
@Override
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public long getId()
{
	return id;
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:8,代碼來源:LanguageString.java

示例8: buildGeneratedValue

import javax.persistence.GenerationType; //導入依賴的package包/類
private GeneratedValue buildGeneratedValue(Element element) {
	Element subElement = element != null ? element.element( "generated-value" ) : null;
	if ( subElement != null ) {
		AnnotationDescriptor ad = new AnnotationDescriptor( GeneratedValue.class );
		String strategy = subElement.attributeValue( "strategy" );
		if ( "TABLE".equalsIgnoreCase( strategy ) ) {
			ad.setValue( "strategy", GenerationType.TABLE );
		}
		else if ( "SEQUENCE".equalsIgnoreCase( strategy ) ) {
			ad.setValue( "strategy", GenerationType.SEQUENCE );
		}
		else if ( "IDENTITY".equalsIgnoreCase( strategy ) ) {
			ad.setValue( "strategy", GenerationType.IDENTITY );
		}
		else if ( "AUTO".equalsIgnoreCase( strategy ) ) {
			ad.setValue( "strategy", GenerationType.AUTO );
		}
		else if ( StringHelper.isNotEmpty( strategy ) ) {
			throw new AnnotationException( "Unknown GenerationType: " + strategy + ". " + SCHEMA_VALIDATION );
		}
		copyStringAttribute( ad, subElement, "generator", false );
		return AnnotationFactory.create( ad );
	}
	else {
		return null;
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:28,代碼來源:JPAOverriddenAnnotationReader.java

示例9: checkGeneratedValueAnnotation

import javax.persistence.GenerationType; //導入依賴的package包/類
private IdGenerator checkGeneratedValueAnnotation() {
	IdGenerator generator = null;
	AnnotationInstance generatedValueAnnotation = JandexHelper.getSingleAnnotation(
			annotations(),
			JPADotNames.GENERATED_VALUE
	);
	if ( generatedValueAnnotation != null ) {
		String name = JandexHelper.getValue( generatedValueAnnotation, "generator", String.class );
		if ( StringHelper.isNotEmpty( name ) ) {
			generator = getContext().getMetadataImplementor().getIdGenerator( name );
			if ( generator == null ) {
				throw new MappingException( String.format( "Unable to find named generator %s", name ), null );
			}
		}
		else {
			GenerationType genType = JandexHelper.getEnumValue(
					generatedValueAnnotation,
					"strategy",
					GenerationType.class
			);
			String strategy = EnumConversionHelper.generationTypeToGeneratorStrategyName(
					genType,
					getContext().getMetadataImplementor().getOptions().useNewIdentifierGenerators()
			);
			generator = new IdGenerator( null, strategy, null );
		}
	}
	return generator;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:30,代碼來源:BasicAttribute.java

示例10: getId

import javax.persistence.GenerationType; //導入依賴的package包/類
@Id
@SequenceGenerator(name = "ID_SEQ")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ID_SEQ")
@Column(name = "ID", nullable = false)
public Long getId() {
	return id;
}
 
開發者ID:xujeff,項目名稱:tianti,代碼行數:8,代碼來源:OracleLongEntity.java

示例11: getVendorPartNumber

import javax.persistence.GenerationType; //導入依賴的package包/類
@TableGenerator(
    name="vendorPartGen",
    table="PERSISTENCE_ORDER_SEQUENCE_GENERATOR",
    pkColumnName="GEN_KEY",
    valueColumnName="GEN_VALUE",
    pkColumnValue="VENDOR_PART_ID",
    allocationSize=10)
@Id
@GeneratedValue(strategy=GenerationType.TABLE, generator="vendorPartGen")
public Long getVendorPartNumber() {
    return vendorPartNumber;
}
 
開發者ID:wwu-pi,項目名稱:tap17-muggl-javaee,代碼行數:13,代碼來源:VendorPart.java

示例12: getId

import javax.persistence.GenerationType; //導入依賴的package包/類
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
//@GeneratedValue(strategy = GenerationType.AUTO, generator = "uuid-string")
//@GeneratedValue(generator = "system-uuid")
   //@GenericGenerator(name = "system-uuid", strategy = "uuid")
   //@Column(length = 32)
public Long getId() {
	return id;
}
 
開發者ID:wkeyuan,項目名稱:DWSurvey,代碼行數:10,代碼來源:IdLongEntity.java

示例13: getId

import javax.persistence.GenerationType; //導入依賴的package包/類
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.AUTO)
@Override
public Long getId() {
    return id;
}
 
開發者ID:bcgov,項目名稱:sbc-qsystem,代碼行數:8,代碼來源:QUser.java

示例14: getId

import javax.persistence.GenerationType; //導入依賴的package包/類
@Id
@GeneratedValue(strategy = GenerationType.TABLE, generator="gen_camp")
@TableGenerator(name="gen_camp", table="hel_idgen", pkColumnName="taula", valueColumnName="valor")
@Column(name="id")
public Long getId() {
	return id;
}
 
開發者ID:GovernIB,項目名稱:helium,代碼行數:8,代碼來源:Camp.java

示例15: getId

import javax.persistence.GenerationType; //導入依賴的package包/類
@Id
@GeneratedValue(strategy = GenerationType.TABLE, generator="gen_registre")
@TableGenerator(name="gen_registre", table="hel_idgen", pkColumnName="taula", valueColumnName="valor")
@Column(name="id")
public Long getId() {
	return id;
}
 
開發者ID:GovernIB,項目名稱:helium,代碼行數:8,代碼來源:Registre.java


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