Sequence increment is not correctly determined


Switching from Hibernate 5.3.7 to 5.4.1 some of our JUnit-Tests failed with the following message:

But a quick look on the Oracle DB showed that the sequence GA_NODEINFO_OID_SEQ had the increment set to 50. So the message is clearly not right.

Cause for this error is probably a bug in the heuristic to determine the increment of a sequence.

In our case the problem is that the metadata for the sequence can not be determined, because the sequence is a synonym to a sequence in a different schema, i.e. the name of the current schema is not in the table all_sequences.

In the SequenceStyleGenerator the schema name is therefore null

and the increment value is in consequence the value of the first sequence with the same sequence name.

Unfortunately our test DB contains more than one schema with the same setup, so the sequence name is not unique within the DB and the increment has changed over time. So we get sometimes the wrong increment value from a sequence in a different schema.

So in our case it would be correct to return an increment value only if sequence name and schema name (or catalog name) are matched.


Hibernate: 4.5.1.FINAL
JVM: Oracle JDK 1.8.0_181
OS: Windows 7 and SLES 12 SP3
DB: Oracle 12.2 and Oracle 18c


Russ Tokuyama
February 27, 2020, 2:28 AM

We’ve also encountered this issue. Our Spring Boot app fails to start up with this error (sequence-name redacted:

hibernate-core: 5.4.9.Final
JVM: Zulu
OS: Macos 10.14.6
DB: Oracle 12c

I did some debugging with IntelliJ and traced things to the getSequenceIncrementValue() in SequenceStyleGenerator like Florian reported.

Reverting to hibernate-core to 5.3.12.Final avoided the error and our app started up and worked with the Oracle sequence set to increment by 50 to match the default allocationSize of 50 for the @SequenceGenerator annotation.

Nathan Xu
February 27, 2020, 3:04 PM

I once fixed a similar issue for Mariadb. I solved the issue by adding a SQL filter of 'table_schema = database()'. I have zero experience on Oracle. Could you guys help me to answer the following question:

Is it possible to get sequence schema information in Oracle’s sequence info table?

It would be easy to fix it if there is affirmative answer to the above question.


Nathan Xu
February 27, 2020, 3:19 PM

I think I’ve figured out. We should use ‘USER_SEQUENCES’ instead of `ALL_SEQUENCES' to limit the sequence to current user/schema. I’ll create a PR for this soon.

Nathan Xu
February 27, 2020, 3:41 PM

PR created at:

Hannes Rosenögger
May 19, 2020, 12:34 PM

This change broke some setups.



Nathan Xu


Florian Kaiser

Fix versions





Suitable for new contributors


Requires Release Note


Pull Request




Worked in


Affects versions