wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes Hibernate3.5.6 problem with HSQLDB-2.1.0 dialect Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate3.5.6 problem with HSQLDB-2.1.0 dialect" Watch "Hibernate3.5.6 problem with HSQLDB-2.1.0 dialect" New topic
Author

Hibernate3.5.6 problem with HSQLDB-2.1.0 dialect

K Mansoor
Ranch Hand

Joined: Jan 10, 2006
Posts: 52
Hello All-

Has anyone found a problem using Hibernate3.5.6 with HSQL-2.1.0? It appears as though hibernate is not understanding the dialect. I have a simple entity in my application, hibernate emits the following DDL (and the error it encounters)



I think HSQLDB automatically creates a primary key for an identity column and hence this collision.
Any help will be greatly appreciated.
Arun Kumarr
Ranch Hand

Joined: May 16, 2005
Posts: 513

To me the problem sounds like you are trying to insert a row with primary key column value which is already present in the database.
Please verify what type of primary key column you are having and what are the primary key generation strategies deployed by hibernate.


If you are not laughing at yourself, then you just didn't get the joke.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Not sure that's what it is. Hibernate doesn't insert rows as part of its DDL.

It does sound like the HSQL dialect doesn't know about the automatic PK generation. You can confirm (and fix) this by looking at the source. Have you checked the Hibernate JIRA?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Arun Kumarr
Ranch Hand

Joined: May 16, 2005
Posts: 513

mea culpa. I didn't see the create faculty before that.
Yes, It seems like the "identity" key word manages to make the id column a primary key and explicitly doing another "primary key(id)" is throwing the error. Did you try running the DDL directly removing the "primary key(id)"? Any luck.
K Mansoor
Ranch Hand

Joined: Jan 10, 2006
Posts: 52
Yes, I took the Hibernate generated DDL, removed the primary key clause and ran. It ran fine AND a unique index was (automatically) created by HSQL for me on the id (which is an identity column).
K Mansoor
Ranch Hand

Joined: Jan 10, 2006
Posts: 52
Arun Kumarr wrote:To me the problem sounds like you are trying to insert a row with primary key column value which is already present in the database.
Please verify what type of primary key column you are having and what are the primary key generation strategies deployed by hibernate.


I'm not inserting any rows. This error shows up when tomcat starts and tries to load my web app. The error comes from DDL, not DML.
Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate3.5.6 problem with HSQLDB-2.1.0 dialect
 
Similar Threads
Hibernate is driving me crazy !
Problems using GenerationType.IDENTITY for in-memory databases
Noob error :org.hibernate.exception.SQLGrammarException: could not insert [com.sample.Person]
No error/exception in log on insert yet no row inserted to db
Hibernate naming strategy problem