• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Record getting inserted instead of update

 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi i am trying to update record in database using hibernate but intead of updating record one new record is getting inserted.

bellow is my method for update()



Bellow is my database table

DDL


Bellow is my hibernate persistant class

 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you use a query to get an entity by its primary key? Its less work to use Session.get or Session.load.

Why do you use uniqueResult when the query is by primary key?

What value does inModule.getId() return?
 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes the id was null.. thanks...

today is my first day to hibernate and get & load is next
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic