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

Maksym Symonov July 26, 2018 at 9:55 AM
Actually i have just found another solution in the related Jira https://hibernate.atlassian.net/browse/HHH-11699.
The property below did the trick for me.
spring.jpa.properties.hibernate.id.new_generator_mappings: true
So technically the issue is fixed, but probably it still exists in "old" generator mappings.

Guillaume Smet July 26, 2018 at 9:47 AM
could you open a new JIRA with a test case based on our test case template?
https://github.com/hibernate/hibernate-test-case-templates/tree/master/orm/hibernate-orm-5
Thanks!

Maksym Symonov July 26, 2018 at 9:25 AM
Could you please reopen the jira? It is reproduced for me. I can see that the latest codebase still doesn't read "schema" attribute. See the previous comment for the place affected

Stefan Frutig November 8, 2017 at 10:10 AM
This issue isn't completely solved with version 5.x (we have specifically version 5.2.10.Final). If the SequenceGenerator is defined in orm.xml mapping-file, then the schema is not used and same exception as described is thrown.
I think the problem could be solved with one line in org.hibernate.cfg.annotations.reflection. JPAOverriddenAnnotationReader in method buildSequenceGeneratorAnnotation(Element element), where schema is not read.
Steve Ebersole January 8, 2016 at 4:07 PM
Thanks !
I wrote a mapping for a sequence such as:
@SequenceGenerator( schema="jaseadm", name="applicantSignupSequence", sequenceName="seq_applicant_signup" )
And the generated SQL is as follows:
DEBUG org.hibernate.SQL - select seq_applicant_signup.nextval from dual
Which leads to this:
WARN o.h.e.jdbc.spi.SqlExceptionHelper - SQL Error: 2289, SQLState: 42000
ERROR o.h.e.jdbc.spi.SqlExceptionHelper - ORA-02289: sequence does not exist