Sequence increment is not correctly determined

Description

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.

Environment

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

Assignee

Nathan Xu

Reporter

Florian Kaiser

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Worked in

5.3.7

Affects versions

Priority

Major
Configure