@Id @GeneratedValue(strategy = GenerationType.TABLE, generator = "dog") @TableGenerator( name = "dog", table = "sequences", pkColumnName = "key", pkColumnValue = "dog", valueColumnName = "seed" ) public Long getId() { return id; }
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 ); }
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(); } }
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(); } }
/** * 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); }
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; } }
private TableGenerator getTableGenerator(Element tree, XMLContext.Default defaults) { Element element = tree != null ? tree.element( annotationToXml.get( TableGenerator.class ) ) : null; if ( element != null ) { return buildTableGeneratorAnnotation( element, defaults ); } else if ( defaults.canUseJavaAnnotations() && isPhysicalAnnotationPresent( TableGenerator.class ) ) { TableGenerator tableAnn = getPhysicalAnnotation( TableGenerator.class ); if ( StringHelper.isNotEmpty( defaults.getSchema() ) || StringHelper.isNotEmpty( defaults.getCatalog() ) ) { AnnotationDescriptor annotation = new AnnotationDescriptor( TableGenerator.class ); annotation.setValue( "name", tableAnn.name() ); annotation.setValue( "table", tableAnn.table() ); annotation.setValue( "catalog", tableAnn.table() ); if ( StringHelper.isEmpty( (String) annotation.valueOf( "catalog" ) ) && StringHelper.isNotEmpty( defaults.getCatalog() ) ) { annotation.setValue( "catalog", defaults.getCatalog() ); } annotation.setValue( "schema", tableAnn.table() ); if ( StringHelper.isEmpty( (String) annotation.valueOf( "schema" ) ) && StringHelper.isNotEmpty( defaults.getSchema() ) ) { annotation.setValue( "catalog", defaults.getSchema() ); } annotation.setValue( "pkColumnName", tableAnn.pkColumnName() ); annotation.setValue( "valueColumnName", tableAnn.valueColumnName() ); annotation.setValue( "pkColumnValue", tableAnn.pkColumnValue() ); annotation.setValue( "initialValue", tableAnn.initialValue() ); annotation.setValue( "allocationSize", tableAnn.allocationSize() ); annotation.setValue( "uniqueConstraints", tableAnn.uniqueConstraints() ); return AnnotationFactory.create( annotation ); } else { return tableAnn; } } else { return null; } }
@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 @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 @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 @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 @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 @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 @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 @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 @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 @GeneratedValue(strategy = GenerationType.TABLE, generator="gen_notif_electronica") @TableGenerator(name="gen_notif_electronica", table="hel_idgen", pkColumnName="taula", valueColumnName="valor") @Column(name="id") public Long getId() { return id; }
@Id @GeneratedValue(strategy = GenerationType.TABLE, generator="gen_formext") @TableGenerator(name="gen_formext", table="hel_idgen", pkColumnName="taula", valueColumnName="valor") @Column(name="id") public Long getId() { return id; }
@Id @GeneratedValue(strategy = GenerationType.TABLE, generator="gen_enumeracio_valor") @TableGenerator(name="gen_enumeracio_valor", table="hel_idgen", pkColumnName="taula", valueColumnName="valor") @Column(name="id") public Long getId() { return this.id; }
@Id @GeneratedValue(strategy = GenerationType.TABLE, generator="gen_carrec_jbpmid") @TableGenerator(name="gen_carrec_jbpmid", table="hel_idgen", pkColumnName="taula", valueColumnName="valor") @Column(name="id") public Long getId() { return id; }
@Id @GeneratedValue(strategy = GenerationType.TABLE, generator="gen_portasignatures") @TableGenerator(name="gen_portasignatures", table="hel_idgen", pkColumnName="taula", valueColumnName="valor") @Column(name="id") public Long getId() { return id; }
@Id @GeneratedValue(strategy = GenerationType.TABLE, generator="gen_repro") @TableGenerator(name="gen_repro", table="hel_idgen", pkColumnName="taula", valueColumnName="valor") @Column(name="id") public Long getId() { return id; }
@Id @GeneratedValue(strategy = GenerationType.TABLE, generator="gen_area_membre") @TableGenerator(name="gen_area_membre", table="hel_idgen", pkColumnName="taula", valueColumnName="valor") @Column(name="id") public Long getId() { return id; }
@Id @GeneratedValue(strategy = GenerationType.TABLE, generator="gen_document_store") @TableGenerator(name="gen_document_store", table="hel_idgen", pkColumnName="taula", valueColumnName="valor") @Column(name="id") public Long getId() { return id; }
@Id @GeneratedValue(strategy = GenerationType.TABLE, generator="gen_document_tasca") @TableGenerator(name="gen_document_tasca", table="hel_idgen", pkColumnName="taula", valueColumnName="valor") @Column(name="id") public Long getId() { return id; }
@Id @GeneratedValue(strategy = GenerationType.TABLE, generator="gen_camp_regmembre") @TableGenerator(name="gen_camp_regmembre", table="hel_idgen", pkColumnName="taula", valueColumnName="valor") @Column(name="id") public Long getId() { return id; }
@Id @GeneratedValue(strategy = GenerationType.TABLE, generator="gen_entorn") @TableGenerator(name="gen_entorn", table="hel_idgen", pkColumnName="taula", valueColumnName="valor") @Column(name="id") public Long getId() { return id; }
@Id @GeneratedValue(strategy = GenerationType.TABLE, generator="gen_termini_iniciat") @TableGenerator(name="gen_termini_iniciat", table="hel_idgen", pkColumnName="taula", valueColumnName="valor") @Column(name="id") public Long getId() { return id; }
@Id @GeneratedValue(strategy = GenerationType.TABLE, generator="gen_consulta") @TableGenerator(name="gen_consulta", table="hel_idgen", pkColumnName="taula", valueColumnName="valor") @Column(name="id") public Long getId() { return id; }
@Id @GeneratedValue(strategy = GenerationType.TABLE, generator="gen_festiu") @TableGenerator(name="gen_festiu", table="hel_idgen", pkColumnName="taula", valueColumnName="valor") @Column(name="id") public Long getId() { return id; }
@Id @GeneratedValue(strategy = GenerationType.TABLE, generator="gen_expedient_tipus_seqany") @TableGenerator(name="gen_expedient_tipus_seqany", table="hel_idgen", pkColumnName="taula", valueColumnName="valor") @Column(name="id") public Long getId() { return id; }
@Id @GeneratedValue(strategy = GenerationType.TABLE, generator="gen_validacio") @TableGenerator(name="gen_validacio", table="hel_idgen", pkColumnName="taula", valueColumnName="valor") @Column(name="id") public Long getId() { return id; }
@Id @GeneratedValue(strategy = GenerationType.TABLE, generator="gen_enumeracio") @TableGenerator(name="gen_enumeracio", table="hel_idgen", pkColumnName="taula", valueColumnName="valor") @Column(name="id") public Long getId() { return this.id; }
@Id @GeneratedValue(strategy = GenerationType.TABLE, generator="gen_expedient_log") @TableGenerator(name="gen_expedient_log", table="hel_idgen", pkColumnName="taula", valueColumnName="valor") @Column(name="id") public Long getId() { return id; }
@Id @GeneratedValue(strategy = GenerationType.TABLE, generator="gen_definicio_proces") @TableGenerator(name="gen_definicio_proces", table="hel_idgen", pkColumnName="taula", valueColumnName="valor") @Column(name="id") public Long getId() { return id; }
@Id @GeneratedValue(strategy = GenerationType.TABLE, generator="gen_carrec") @TableGenerator(name="gen_carrec", table="hel_idgen", pkColumnName="taula", valueColumnName="valor") @Column(name="id") public Long getId() { return id; }
@Id @GeneratedValue(strategy = GenerationType.TABLE, generator="gen_persona") @TableGenerator(name="gen_persona", table="hel_idgen", pkColumnName="taula", valueColumnName="valor") @Column(name="id") public Long getId() { return this.id; }