Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error when inserting data in hibernate

 
Maya Pillai
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And we have to guess what database you use?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic