This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Error when inserting data in hibernate 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 "Error when inserting data in hibernate" Watch "Error when inserting data in hibernate" New topic
Author

Error when inserting data in hibernate

Maya Pillai
Ranch Hand

Joined: Jul 17, 2008
Posts: 60
When trying to save , I am getting the following exception.

org.hibernate.HibernateException: The database returned no natively generated identity value


Please help.

user.hbm.xml



UserBean.


package com;




create table script


Christian Dillinger
Ranch Hand

Joined: Jul 20, 2009
Posts: 188
And we have to guess what database you use?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

I think what Christian is trying to suggest is you may be using a database that does not support a "native" key generation mechanism. From the Hibernate documentation:

selects identity, sequence or hilo depending upon the capabilities of the underlying database.

Either none of these mechanisms exist in the database you use or they are perhaps missconfigued?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error when inserting data in hibernate
 
Similar Threads
Hibernate Repeated column mapping problem
SqlException: Attempt to modify an identity column 'USER_ID'
Error running the application
Strange Behavior of Hibernate - NOT RESPONDING
Problem in <many-to-one> relationship