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


Java TableGenerator類代碼示例

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


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

示例1: getId

import javax.persistence.TableGenerator; //導入依賴的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: buildTableGeneratorAnnotation

import javax.persistence.TableGenerator; //導入依賴的package包/類
public static TableGenerator buildTableGeneratorAnnotation(Element element, XMLContext.Default defaults) {
	AnnotationDescriptor ad = new AnnotationDescriptor( TableGenerator.class );
	copyStringAttribute( ad, element, "name", false );
	copyStringAttribute( ad, element, "table", false );
	copyStringAttribute( ad, element, "catalog", false );
	copyStringAttribute( ad, element, "schema", false );
	copyStringAttribute( ad, element, "pk-column-name", false );
	copyStringAttribute( ad, element, "value-column-name", false );
	copyStringAttribute( ad, element, "pk-column-value", false );
	copyIntegerAttribute( ad, element, "initial-value" );
	copyIntegerAttribute( ad, element, "allocation-size" );
	buildUniqueConstraints( ad, element );
	if ( StringHelper.isEmpty( (String) ad.valueOf( "schema" ) )
			&& StringHelper.isNotEmpty( defaults.getSchema() ) ) {
		ad.setValue( "schema", defaults.getSchema() );
	}
	if ( StringHelper.isEmpty( (String) ad.valueOf( "catalog" ) )
			&& StringHelper.isNotEmpty( defaults.getCatalog() ) ) {
		ad.setValue( "catalog", defaults.getCatalog() );
	}
	return AnnotationFactory.create( ad );
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:23,代碼來源:JPAOverriddenAnnotationReader.java

示例3: SeqTableImpl

import javax.persistence.TableGenerator; //導入依賴的package包/類
SeqTableImpl(OperateTarget target, String seqTable, TableGenerator config, String rawTableName, String rawColumnName, SequenceManager parent) {
	super(target, parent);
	Assert.notNull(target);
	this.table = seqTable;
	this.rawTable = rawTableName;
	this.rawColumn = rawColumnName;
	if (config != null)
		this.initValue = config.initialValue();
	String valueColumn = config == null ? "V" : config.valueColumnName();

	this.update = "UPDATE " + table + " SET " + valueColumn + "=? WHERE " + valueColumn + "=?";
	this.select = "SELECT " + valueColumn + " FROM " + table;
	this.valueStep = JefConfiguration.getInt(DbCfg.SEQUENCE_BATCH_SIZE, 20);// 每次取一批
	if (valueStep < 1)
		valueStep = config == null ? 20 : config.allocationSize();
	if (target != null) {
		tryInit();
	}
}
 
開發者ID:GeeQuery,項目名稱:ef-orm,代碼行數:20,代碼來源:SequenceManager.java

示例4: AdvSeqTableImpl

import javax.persistence.TableGenerator; //導入依賴的package包/類
AdvSeqTableImpl(OperateTarget target, String key, TableGenerator config, String rawTable, String rawColumn, SequenceManager parent) {
	super(target, parent);
	Assert.notNull(target);
	this.table = publicTableName;
	this.key = key;

	this.rawTable = rawTable;
	this.rawColumn = rawColumn;
	this.initValue = config == null ? 0 : config.initialValue();

	this.valueStep = JefConfiguration.getInt(DbCfg.SEQUENCE_BATCH_SIZE, 20);
	if (valueStep < 1)
		valueStep = 20;

	this.update = "UPDATE " + table + " SET V=? WHERE V=? AND T='" + key + "'";
	this.select = "SELECT V FROM " + table + " WHERE T='" + key + "'";
	if (target != null) {
		tryInit();
	}
}
 
開發者ID:GeeQuery,項目名稱:ef-orm,代碼行數:21,代碼來源:SequenceManager.java

示例5: TableIdGenerator

import javax.persistence.TableGenerator; //導入依賴的package包/類
/**
 * Creates a new instance of {@link SequenceIdGenerator}.
 *
 * @param generator
 *            the annotation that contains our settings
 * @param context
 *            the current context
 */
public TableIdGenerator(final TableGenerator generator, final GeneratorContext context) {
	this.dialect = context.getDialect();
	this.relativeIds = context.isWriteRelativeIds();
	this.allocationSize = generator.allocationSize();
	ModelException.test(this.allocationSize > 0, "Only allocation sizes greater 0 are allowed, found {}",
			this.allocationSize);
	this.nextValue = this.initialValue = generator.initialValue();
	this.maxAllocatedValue = this.initialValue - 1;
	final JpaProvider provider = context.getProvider();
	this.generatorTable = context
			.resolveTable(StringUtils.defaultIfEmpty(generator.table(), provider.getDefaultGeneratorTable()));
	this.valueColumn = this.generatorTable.resolveColumn(StringUtils.defaultIfEmpty(generator.valueColumnName(),
			provider.getDefaultGeneratorTableValueColumnName()));
	this.pkColumn = this.generatorTable.resolveColumn(
			StringUtils.defaultIfEmpty(generator.pkColumnName(), provider.getDefaultGeneratorTablePkColumnName()));
	final String value = StringUtils.defaultIfEmpty(generator.pkColumnValue(),
			provider.getDefaultGeneratorTablePkColumnValue());
	this.pkColumnValue = StringUtils.isEmpty(value) ? null : PrimitiveColumnExpression.create(value, this.dialect);
}
 
開發者ID:liefke,項目名稱:org.fastnate,代碼行數:28,代碼來源:TableIdGenerator.java

示例6: getTableGenerator

import javax.persistence.TableGenerator; //導入依賴的package包/類
private Annotation getTableGenerator(List<Element> elementsForProperty, XMLContext.Default defaults) {
	for ( Element element : elementsForProperty ) {
		Element subelement = element != null ? element.element( annotationToXml.get( TableGenerator.class ) ) : null;
		if ( subelement != null ) {
			return buildTableGeneratorAnnotation( subelement, defaults );
		}
	}
	if ( elementsForProperty.size() == 0 && defaults.canUseJavaAnnotations() ) {
		return getPhysicalAnnotation( TableGenerator.class );
	}
	else {
		return null;
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:15,代碼來源:JPAOverriddenAnnotationReader.java

示例7: getVendorPartNumber

import javax.persistence.TableGenerator; //導入依賴的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

示例8: getId

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

示例9: getId

import javax.persistence.TableGenerator; //導入依賴的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

示例10: getId

import javax.persistence.TableGenerator; //導入依賴的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

示例11: getId

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

示例12: getId

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

示例13: getId

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

示例14: getId

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

示例15: getId

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


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