Hibernate ignores 'schema' attribute of @SequenceGenerator for Oracle sequences

Description

We have a sequence defined with the format:

The following SQL gets generated:

Hibernate: select packing_seq.nextval from dual

instead of the required

select packing.packing_seq.nextval from dual

which ends up generating a:
org.hibernate.engine.jdbc.spi.SqlExceptionHelper - SQL Error: 2289, SQLState: 42000
org.hibernate.engine.jdbc.spi.SqlExceptionHelper - ORA-02289: sequence does not exist

Our workaround for now is to define the sequence generator as:

The same issue has been reported in the past and closed, mentioning that the above wasn't reproduced on version 5.0.6:
https://hibernate.atlassian.net/browse/HHH-7232

Attachments

1

Activity

Show:

IT Support April 21, 2020 at 2:54 AM

same issue for SQL server on 5.2.x and 5.4.x

Anderson Dorow May 4, 2017 at 2:36 PM

Hi Andrea,

so, the solution we started to use is the one you mentioned, to just explicitely define:

Andrea Boriero May 2, 2017 at 8:58 PM

It seems spring decided to set this value to false, it does not depend on your app.

Anderson Dorow May 2, 2017 at 8:53 PM

well, that's weird. The sample application I sent you is quite small, and clearly not upgrading any app (right?).

So what could be the reason for Spring to apply this compatibility? Or put differently: what is making Spring thing that we're upgrading from 4.x to 5.x?

Tomorrow morning I will check the dependencies we have in our project, and see if I find something old, to bump up its version.

Andrea Boriero May 2, 2017 at 4:05 PM

hibernate.id.new_generator_mappings default value is true, it seems spring change the default value to false.

The only reason for changing the default behaviour is for compatibility when upgrading existing applications from 4.x to 5.x.

Details

Assignee

Reporter

Components

Affects versions

Priority

Created April 27, 2017 at 1:46 PM
Updated April 21, 2020 at 2:54 AM