@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 ( !BinderHelper.isEmptyAnnotationValue( sequenceGeneratorAnnotation.sequenceName() ) ) { definitionBuilder.addParam( SequenceStyleGenerator.SEQUENCE_PARAM, sequenceGeneratorAnnotation.sequenceName() );
public SequenceGeneratorDiscriptor(SequenceGenerator sequenceGenerator, String defaultSchemaName) { this.initialValue = sequenceGenerator.initialValue(); this.allocationSize = sequenceGenerator.allocationSize(); this.sequenceName = sequenceGenerator.sequenceName().isEmpty() ? default_sequence_name : sequenceGenerator .sequenceName(); this.schemaName = sequenceGenerator.schema().isEmpty() ? defaultSchemaName : sequenceGenerator.schema(); }
assertNotADuplicateName(gen.generator(), theNames); assertNotADuplicateName(sg.name(), null); assertNotADuplicateName(sg.sequenceName(), null); assertEquals(gen.generator(), sg.name()); assertEquals(gen.generator(), sg.sequenceName());
if (sequenceGenerator != null) { if (sequenceGenerator.name().equals(genName)) { genName = sequenceGenerator.sequenceName();
/** * INTERNAL: */ public String getSequenceName() { return m_sequenceGenerator.sequenceName(); } }
private String getSequenceName(Class<?> clazz) { for (Field f : clazz.getDeclaredFields()) { if (f.isAnnotationPresent(SequenceGenerator.class)) { SequenceGenerator sg = f.getAnnotation(SequenceGenerator.class); return sg.sequenceName(); } } return null; }
idGen.addParam( SequenceStyleGenerator.SCHEMA, seqGen.schema() ); if ( !BinderHelper.isDefault( seqGen.sequenceName() ) ) { idGen.addParam( SequenceStyleGenerator.SEQUENCE_PARAM, seqGen.sequenceName() ); idGen.setIdentifierGeneratorStrategy( "seqhilo" ); if ( !BinderHelper.isDefault( seqGen.sequenceName() ) ) { idGen.addParam( org.hibernate.id.SequenceGenerator.SEQUENCE, seqGen.sequenceName() );
@Override public boolean process(final Set<? extends TypeElement> annotations, final RoundEnvironment roundEnv) { roundEnv .getElementsAnnotatedWith(SequenceGenerator.class) .stream() .filter(element -> element.getAnnotation(JArchConfiguration.class) == null || !element.getAnnotation(JArchConfiguration.class).ignorePatternsObjetcsDataBase()) .filter(element -> element.getEnclosingElement().getAnnotation(JArchConfiguration.class) == null || !element.getEnclosingElement().getAnnotation(JArchConfiguration.class).ignorePatternsObjetcsDataBase()) .forEach(element -> { final SequenceGenerator anotacao = element.getAnnotation(SequenceGenerator.class); if (anotacao.sequenceName().isEmpty()) { processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "JARCH ERROR: @SequenceGenerator com sequenceName vazio não permitido. Informar nome da sequence", element); } if (anotacao.sequenceName().length() < MIN_SIZE || anotacao.sequenceName().toCharArray()[POSITION_UNDERLINE] != '_') { processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "JARCH ERROR: @SequenceGenerator com name fora do padrão. Informar nome da sequence da tabela conforme padronização", element); } if (anotacao.sequenceName().length() > 30) { processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "JARCH ERROR: @SequenceGenerator com atributo sequenceName superior a 30 caracteres. Informar nome da sequence da tabela com no máximo 30 caracteres", element); } }); return false; }
@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 ) ); } }
/** * シーケンスの名前を返します。 * * @param sequenceGenerator * 識別子に付けられたアノテーション * @return シーケンスの名前 */ protected String getSequenceName(final SequenceGenerator sequenceGenerator) { final String sequenceName = sequenceGenerator.sequenceName(); if (!StringUtil.isEmpty(sequenceName)) { return sequenceName; } return entityMeta.getTableMeta().getName() + "_" + propertyMeta.getColumnMeta().getName(); }
/** * シーケンスの名前を返します。 * * @param sequenceGenerator * 識別子に付けられたアノテーション * @return シーケンスの名前 */ protected String getSequenceName(final SequenceGenerator sequenceGenerator) { final String sequenceName = sequenceGenerator.sequenceName(); if (!StringUtil.isEmpty(sequenceName)) { return sequenceName; } return entityMeta.getTableMeta().getName() + "_" + propertyMeta.getColumnMeta().getName(); }
/** * @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 != null) { 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; }
if (sequenceGenerator != null) { if (sequenceGenerator.name().equals(genName)) { genName = sequenceGenerator.sequenceName();