@Override @SuppressWarnings("deprecation") public void interpretSequenceGenerator( SequenceGenerator sequenceGeneratorAnnotation, IdentifierGeneratorDefinition.Builder definitionBuilder) { definitionBuilder.setName( sequenceGeneratorAnnotation.name() ); definitionBuilder.setStrategy( "seqhilo" ); if ( !BinderHelper.isEmptyAnnotationValue( sequenceGeneratorAnnotation.sequenceName() ) ) { definitionBuilder.addParam( org.hibernate.id.SequenceGenerator.SEQUENCE, sequenceGeneratorAnnotation.sequenceName() ); } //FIXME: work on initialValue() through SequenceGenerator.PARAMETERS // steve : or just use o.h.id.enhanced.SequenceStyleGenerator if ( sequenceGeneratorAnnotation.initialValue() != 1 ) { log.unsupportedInitialValue( AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS ); } definitionBuilder.addParam( SequenceHiLoGenerator.MAX_LO, String.valueOf( sequenceGeneratorAnnotation.allocationSize() - 1 ) ); } }
SequenceGenerator sequenceGeneratorAnnotation, IdentifierGeneratorDefinition.Builder definitionBuilder) { definitionBuilder.setName( sequenceGeneratorAnnotation.name() ); definitionBuilder.setStrategy( SequenceStyleGenerator.class.getName() );
private SequenceGeneratorDiscriptor processSequenceGenerator(Class<?> clazz, Field idField, EntityMetadata m, String generatorName) { SequenceGeneratorDiscriptor sgd = null; if (!generatorName.isEmpty()) { SequenceGenerator sequenceGenerator = idField.getAnnotation(SequenceGenerator.class); if (sequenceGenerator == null || !sequenceGenerator.name().equals(generatorName)) { sequenceGenerator = clazz.getAnnotation(SequenceGenerator.class); } sgd = new SequenceGeneratorDiscriptor(sequenceGenerator, m.getSchema()); } else { sgd = new SequenceGeneratorDiscriptor(m.getSchema()); } return sgd; }
if (sequenceGenerator.name().equals(genName)) { genName = sequenceGenerator.sequenceName();
/** * INTERNAL: */ public String getName() { return m_sequenceGenerator.name(); }
idGen.setName( seqGen.name() ); if ( useNewGeneratorMappings ) { idGen.setIdentifierGeneratorStrategy( SequenceStyleGenerator.class.getName() );
private <A> boolean processGeneratorDefinition(A annotation) { SequenceGenerator sequenceGenerator = (SequenceGenerator) annotation; JPAKeyGeneratorManager manager = JPAKeyGeneratorManager .getInstance(); JPASequenceGeneratorDescriptor descriptor = JPASequenceGeneratorDescriptor.extract(sequenceGenerator); try { manager.add(sequenceGenerator.name(), descriptor); } catch (GeneratorNameAlreadyUsedException e) { return false; } return true; }
private <A> boolean processGeneratorDefinition(A annotation) { SequenceGenerator sequenceGenerator = (SequenceGenerator) annotation; JPAKeyGeneratorManager manager = JPAKeyGeneratorManager .getInstance(); JPASequenceGeneratorDescriptor descriptor = JPASequenceGeneratorDescriptor.extract(sequenceGenerator); try { manager.add(sequenceGenerator.name(), descriptor); } catch (GeneratorNameAlreadyUsedException e) { return false; } return true; }
/** * @param locator * the java locator * @param annotation * the annotation * * @since 2.0.0 */ public SequenceGeneratorMetadataImpl(AbstractLocator locator, SequenceGenerator annotation) { super(); this.locator = locator; this.catalog = annotation.catalog(); this.schema = annotation.schema(); this.name = annotation.name(); this.sequenceName = annotation.sequenceName(); this.initialValue = annotation.initialValue(); this.allocationSize = annotation.allocationSize(); }
/** * @param locator * the java locator * @param annotation * the annotation * * @since 2.0.0 */ public SequenceGeneratorMetadataImpl(AbstractLocator locator, SequenceGenerator annotation) { super(); this.locator = locator; this.catalog = annotation.catalog(); this.schema = annotation.schema(); this.name = annotation.name(); this.sequenceName = annotation.sequenceName(); this.initialValue = annotation.initialValue(); this.allocationSize = annotation.allocationSize(); }
/** * @param locator * the java locator * @param annotation * the annotation * * @since 2.0.0 */ public SequenceGeneratorMetadataImpl(AbstractLocator locator, SequenceGenerator annotation) { super(); this.locator = locator; this.catalog = annotation.catalog(); this.schema = annotation.schema(); this.name = annotation.name(); this.sequenceName = annotation.sequenceName(); this.initialValue = annotation.initialValue(); this.allocationSize = annotation.allocationSize(); }
private void readGenValue(GeneratedValue gen, DeployBeanProperty prop) { String genName = gen.generator(); SequenceGenerator sequenceGenerator = find(prop, SequenceGenerator.class); if (sequenceGenerator != null) { if (sequenceGenerator.name().equals(genName)) { genName = sequenceGenerator.sequenceName(); } } GenerationType strategy = gen.strategy(); if (strategy == GenerationType.IDENTITY) { descriptor.setIdType(IdType.IDENTITY); } else if (strategy == GenerationType.SEQUENCE) { descriptor.setIdType(IdType.SEQUENCE); if (genName != null && genName.length() > 0) { descriptor.setIdGeneratorName(genName); } } else if (strategy == GenerationType.AUTO) { if (prop.getPropertyType().equals(UUID.class)){ descriptor.setIdGeneratorName(UuidIdGenerator.AUTO_UUID); descriptor.setIdType(IdType.GENERATOR); } else { // use DatabasePlatform defaults } } }
private void readGenValue(GeneratedValue gen, DeployBeanProperty prop) { String genName = gen.generator(); SequenceGenerator sequenceGenerator = find(prop, SequenceGenerator.class); if (sequenceGenerator != null) { if (sequenceGenerator.name().equals(genName)) { genName = sequenceGenerator.sequenceName(); } } GenerationType strategy = gen.strategy(); if (strategy == GenerationType.IDENTITY) { descriptor.setIdType(IdType.IDENTITY); } else if (strategy == GenerationType.SEQUENCE) { descriptor.setIdType(IdType.SEQUENCE); if (genName != null && genName.length() > 0) { descriptor.setIdGeneratorName(genName); } } else if (strategy == GenerationType.AUTO) { if (prop.getPropertyType().equals(UUID.class)){ descriptor.setIdGeneratorName(UuidIdGenerator.AUTO_UUID); descriptor.setIdType(IdType.GENERATOR); } else { // use DatabasePlatform defaults } } }
if (sequenceGenerator.name().equals(genName)) { genName = sequenceGenerator.sequenceName();
public static JPASequenceGeneratorDescriptor extract(SequenceGenerator sequenceGenerator) { JPASequenceGeneratorDescriptor descriptor = new JPASequenceGeneratorDescriptor(); descriptor.setName(sequenceGenerator.name()); descriptor.setAllocationSize(sequenceGenerator.allocationSize()); descriptor.setInitialValue(sequenceGenerator.initialValue()); descriptor.setSequenceName(sequenceGenerator.sequenceName()); return descriptor; }
@Override @SuppressWarnings("deprecation") public void interpretSequenceGenerator( SequenceGenerator sequenceGeneratorAnnotation, IdentifierGeneratorDefinition.Builder definitionBuilder) { definitionBuilder.setName( sequenceGeneratorAnnotation.name() ); definitionBuilder.setStrategy( "seqhilo" ); if ( !BinderHelper.isEmptyAnnotationValue( sequenceGeneratorAnnotation.sequenceName() ) ) { definitionBuilder.addParam( org.hibernate.id.SequenceGenerator.SEQUENCE, sequenceGeneratorAnnotation.sequenceName() ); } //FIXME: work on initialValue() through SequenceGenerator.PARAMETERS // steve : or just use o.h.id.enhanced.SequenceStyleGenerator if ( sequenceGeneratorAnnotation.initialValue() != 1 ) { log.unsupportedInitialValue( AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS ); } definitionBuilder.addParam( SequenceHiLoGenerator.MAX_LO, String.valueOf( sequenceGeneratorAnnotation.allocationSize() - 1 ) ); } }
if (sequenceGenerator.name().equals(genName)) { genName = sequenceGenerator.sequenceName();