JPA-specified default schema ignored for Hibernate sequences

Description

The <persistence-unit-defaults> element in a JPA 2.0-compliant orm.xml file lets you specify what you would like to have used as the default schema when none is specified elsewhere. Hibernate ignores this element when referring to its own internal sequence, "hibernate_sequence".

I suspect it also ignores the default catalog element as well.

The only workaround is to use the hibernate-specific hibernate.default_schema property.

IMHO Hibernate should honor the JPA orm.xml value if it is present.

Environment

None

Activity

Show:
Lukasz Antoniak
October 12, 2011, 7:52 PM

JPA 2.0 Specification states:

12.2.1.1 schema
The schema subelement applies to all entities, tables, secondary tables, join tables, collection tables, table generators, and sequence generators in the persistence unit.

In my opinion hibernate_sequence shall be included.
Pull request submitted: https://github.com/hibernate/hibernate-core/pull/185

Steve Ebersole
November 29, 2011, 12:32 AM

Applied the fix from Lukasz. Thanks guys!

Strong Liu
November 30, 2011, 8:36 AM

reopen this since the test org.hibernate.test.annotations.id.sequences.HibernateSequenceTest#testHibernateSequenceNextVal fails on all DB (except H2)

14:34:04,951 ERROR SqlExceptionHelper:144 - Unknown database 'hibernate;init=create schema if not exists other_schema'
14:34:05,063 WARN SqlExceptionHelper:143 - SQL Error: 1049, SQLState: 42000
14:34:05,064 ERROR SqlExceptionHelper:144 - Unknown database 'hibernate;init=create schema if not exists other_schema'
14:34:05,064 INFO SchemaExport:344 - HHH000227: Running hbm2ddl schema export

Strong Liu
November 30, 2011, 8:37 AM

I thin this should be a unit test instead of a functional test

Brett Meyer
March 7, 2014, 10:09 PM

Bulk closing tickets resolved in released versions

Assignee

Steve Ebersole

Reporter

Laird Nelson

Fix versions

Labels

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure