These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Missing HIBERNATE_SEQUENCE from SchemaExport with Derby
PostPosted: Tue Jan 31, 2012 2:39 pm 
Newbie

Joined: Tue Jan 31, 2012 2:21 pm
Posts: 3
Hi. We're using Hibernate 4.0.0 in JBoss 7.1.0.CR1b with Derby 10.8 and encountering a problem apparently caused by a missing HIBERNATE_SEQUENCE:

Code:
18:14:19,535 ERROR [org.jboss.ejb3.invocation] (MSC service thread 1-4) JBAS014134: EJB Invocation failed on component MyEJBfor method public abstract void com.example.MyEJB.checkDBVersion(): javax.ejb.EJBException: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance
Caused by: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance
Caused by: javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: SEQUENCE 'HIBERNATE_SEQUENCE' does not exist.
Caused by: org.hibernate.exception.SQLGrammarException: SEQUENCE 'HIBERNATE_SEQUENCE' does not exist.
Caused by: java.sql.SQLSyntaxErrorException: SEQUENCE 'HIBERNATE_SEQUENCE' does not exist.
Caused by: org.apache.derby.client.am.SqlException: SEQUENCE 'HIBERNATE_SEQUENCE' does not exist.


(two pages of stack traces snipped)

If I set the property 'hibernate.hbm2ddl.auto' to 'update' then the error doesn't occur (the log shows HIBERNATE_SEQUENCE being created, as we might expect), but in normal usage we prefer not to set this property. Instead we're using org.hibernate.tool.hbm2ddl.SchemaExport to generate the database schema & using this to create the database before deploying our app to JBoss.

The schema generated by SchemaExport for the DerbyTenSevenDialect doesn't create HIBERNATE_SEQUENCE, which is presumably the cause of this issue. However, I note when we create the schema using the PostgreSQLDialect in the same way, a "create sequence hibernate_sequence;" line is included in the exported schema, and thus the "HIBERNATE_SEQUENCE does not exist" error doesn't occur when we're using a Postgres datasource.

We're not sure what to make of this.

Are we correct to expect the schema output by SchemaExport to create hibernate_sequence if hibernate_sequence will be required to access the exported database through Hibernate/JPA using the same dialect?

Is there something specific we should do to force SchemaExport to include the hibernate_sequence for the DerbyTenSevenDialect?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.