Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Error when inserting data in hibernate  RSS feed

 
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: 200
  • 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?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!