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.

Attachments

2
  • 30 Mar 2011, 05:50 PM
  • 30 Mar 2011, 05:44 PM

Activity

Brett MeyerMarch 7, 2014 at 10:09 PM

Bulk closing tickets resolved in released versions

Strong LiuNovember 30, 2011 at 8:37 AM

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

Strong LiuNovember 30, 2011 at 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

Steve EbersoleNovember 29, 2011 at 12:32 AM

Applied the fix from Lukasz. Thanks guys!

Lukasz AntoniakOctober 12, 2011 at 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

Fixed

Details

Assignee

Reporter

Labels

Time tracking

0.22h logged

Components

Fix versions

Affects versions

Priority

Created March 30, 2011 at 3:13 PM
Updated March 7, 2014 at 10:09 PM
Resolved November 30, 2011 at 8:58 AM

Flag notifications