本文整理匯總了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; }
示例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 );
}
示例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();
}
}
示例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();
}
}
示例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);
}
示例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;
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}