[hibernate-dev] SchemaCreatorImpl always creating a poolable sequence

Vlad Mihalcea mihalcea.vlad at gmail.com
Thu Jul 28 07:02:43 EDT 2016


Is it that you get the exception even if the incrementSize is 1? I guess
this is an issue that we need to open a Jira ticket for it.

On Thu, Jul 28, 2016 at 1:57 PM, Mark Rotteveel <mark at lawinegevaar.nl>
wrote:

> On 28-7-2016 12:22, Vlad Mihalcea wrote:
>
>> 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" );
>>
>
> Yes, and the above exception is my problem, however this default
> implementation suggests that this method should only be called if pooled
> sequences are supported (quod non), but in the current code it is called
> always in org.hibernate.tool.schema.internal.SchemaCreatorImpl.
>
> Now, this method is overridden in PostgreSQL and HSQLDB dialects.
>>
>
> Yes, but both support pooled sequences.
>
> I think we should create the sequence generator as indicated in this
>> Firebird documentation:
>>
>> http://firebirdsql.org/manual/generatorguide-sqlsyntax.html
>>
>
> The current dialect already does that, but it isn't working because of
> above code. Providing the following override does seem to work, but this
> seems at odds with the exception thrown in the default implementation.
>
> @Override
> protected String getCreateSequenceString(String sequenceName, int
> initialValue, int incrementSize) throws MappingException {
>         // Ignore initialValue and incrementSize
>         return getCreateSequenceString( sequenceName );
> }
>
> For Firebird 2.5,
> http://www.firebirdsql.org/file/documentation/reference_manuals/fblangref25-en/html/fblangref25-ddl-sequence.html
> is more up-to-date.
>
> I'm currently creating a new Firebird 2.5 specific dialect, and then I'm
> going to add a Firebird 3.0 dialect.
>
> I might clean up the old InterbaseDialect and FirebirdDialect, but I don't
> want to touch those too much (especially since Firebird and Interbase
> should now be considered two distinct databases).
>
> Shouldn't we use GEN_ID for the pooled optimizers?
>>
>
> Yes GEN_ID could be used for that, but as far as I can tell the current
> support for pooled sequences seems to require specifying the increment size
> in the sequence DDL, which is not supported by Firebird.
>
> Is there a specific extension point to override this, is it the
> getDefaultMultiTableBulkIdStrategy()?
>
> Mark
> --
> Mark Rotteveel
>


More information about the hibernate-dev mailing list