[hibernate-dev] SchemaCreatorImpl always creating a poolable sequence
Vlad Mihalcea
mihalcea.vlad at gmail.com
Thu Jul 28 06:22:52 EDT 2016
Hi Mark,
I've just run the PooledHiLoSequenceIdentifierTest test after modifying the
TABLE to SEQUENCE to see how it works and this is what I found:
1. SchemaCreatorImpl calls String[] getCreateSequenceStrings(String
sequenceName, int initialValue, int incrementSize)
2. The String getCreateSequenceString(String sequenceName, int initialValue,
int incrementSize) is then called which does this:
if ( supportsPooledSequences() ) {
return getCreateSequenceString( sequenceName ) + " start with " +
initialValue + " increment by " + incrementSize;
}
throw new MappingException( getClass().getName() + " does not support
pooled sequences" );
Now, this method is overridden in PostgreSQL and HSQLDB dialects.
I think we should create the sequence generator as indicated in this
Firebird documentation:
http://firebirdsql.org/manual/generatorguide-sqlsyntax.html
Shouldn't we use GEN_ID for the pooled optimizers?
Vlad
On Thu, Jul 28, 2016 at 12:54 PM, Mark Rotteveel <mark at lawinegevaar.nl>
wrote:
> I'm working on improving support for Firebird in Hibernate, and I have
> run into a problem where
> org.hibernate.tool.schema.internal.SchemaCreatorImpl is always trying to
> create a pooled sequence.
>
> Specifically:
>
> applySqlStrings(
> dialect.getCreateSequenceStrings(
>
> jdbcEnvironment.getQualifiedObjectNameFormatter().format(
> sequence.getName(), dialect ),
> sequence.getInitialValue(),
> sequence.getIncrementSize()
> ),
> formatter,
> options,
> targets
> );
>
> With the default implementation this results in a
> org.hibernate.MappingException: org.hibernate.dialect.FirebirdDialect
> does not support pooled sequences (or at least: not by specifying it in
> the DDL).
>
> I'd like to know if I should just override
> protected String getCreateSequenceString(String sequenceName, int
> initialValue, int incrementSize)
>
> and ignore the initialValue and incrementSize and just return the result
> of getCreateSequenceString(sequenceName)
>
> or if I should change the above code to call the deprecated(!) method
> getCreateSequenceStrings(String sequenceName) is
> supportsPooledSequences() is false:
>
> dialect.supportsPooledSequences()
> ? dialect.getCreateSequenceStrings(
>
> jdbcEnvironment.getQualifiedObjectNameFormatter().format(
> sequence.getName(), dialect ),
> sequence.getInitialValue(),
> sequence.getIncrementSize()
> ) : dialect.getCreateSequenceStrings(
>
> jdbcEnvironment.getQualifiedObjectNameFormatter().format(
> sequence.getName(), dialect )
> ),
>
> Kind regards,
> Mark Rotteveel
> --
> Mark Rotteveel
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>
More information about the hibernate-dev
mailing list