Oracle-Dialect does not find Sequences outside User-Schema

Description

Hibernate with Oracle-Dialect only validates against Sequences of the currently logged in DB-User since 5.4.13. This is because this change, which only looks for user_sequences (before: all_sequences). .

But a very typical Setup is to use a DB-Run-User (without DDL Rights) and fully qualify sequences with the owner-schema, for example MYOWNER.MY_SEQUENCE. This does NOT work with Hibernate 5.4.13.Final and above anymore (Schema-Validation Error).

Environment

None

Activity

Show:
Hannes Rosenögger
May 19, 2020, 12:45 PM
Edited

I think it can be fixed by changing this line to something like:

Select * from all_sequences where SEQUENCE_OWNER LIKE '<schema specified for sequence>';

https://github.com/NathanQingyangXu/hibernate-orm/blob/master/hibernate-core/src/main/java/org/hibernate/dialect/Oracle8iDialect.java#L493

Of course that would require passing the schema name to this function.

 

edit:

After reading a bit more about how oracle sequencing works I think the fix in should be reverted.

People who are experiencing this should simply use a User that does not have permission to see other conflicting sequences. Ideally a different User for every application.

Hannes Rosenögger
May 19, 2020, 1:40 PM

I created to fix this.

Varun Shrivastava
May 21, 2020, 10:15 AM

This is a blocker for Springboot update. When can we expect to have this in a release ?

Hannes Rosenögger
May 21, 2020, 10:20 AM

As a temporary workaround you can set the following property in maven and still update spring boot.

<hibernate.version>5,4,12,Final</hibernate.version>

Nathan Xu
May 29, 2020, 2:51 AM

Sorry for my mistake. I’ve approved the PR

Assignee

Unassigned

Reporter

Stefan Mueller

Fix versions

Labels

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Worked in

5.4.12

Affects versions

Priority

Major
Configure