After upgrade from Hibernate 5.0 to 5.2, we would like to change the strategy for id-generation from "enhanced-table" to "enhanced-sequence" (as recommened in the last newsletter).
We use DB2 V11 OS390. It's possible to create/use sequences with that version.
So we use DB2390Dialect as hibernate dialect (as we did with Hibernate 5.0 and previous versions).
But in class DB2390Dialect, the method "supportsSequences()" returns false.
In this case, Hibernate uses the statement
Code:
select
next_val as id_val
from
TST.HIBERNATE_SEQUENCES for read only with rs use
and keep update
locks
This doesn't work.
In class DB2Dialect the method "supportsSequences()" returns true.
If I configure this class as hibernate dialect, Hibernate uses the statement
Code:
values
nextval for TST.HIBERNATE_SEQUENCES
That works fine.
I think I have to write a class
Quote:
public class DB2390SequenceFixDialect extends DB2390Dialect{
@Override
public boolean supportsSequences() {
return true;
}
}
and configure this class as hibernate dialect. This seems to work. When I configure this class as Hibernate dialect, Hibernate uses the same statement as with DB2Dialect.
Or does anybody have another idea or comment?