当前位置: 首页>>代码示例>>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;未经允许,请勿转载。