This week's giveaway is in the Programmer Certification (OCPJP) forum.
We're giving away four copies of Java Mock Exams (software) and have David Mayer on-line!
See this thread for details.
Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

getHibernateTemplate.SaveorUpdate() object

 
Harish Ponduri
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI every one,

I am trying to update an event in a database, and when i try to update the details of event its working fine but when i try to update the event itself then a new row is getting inserted instead of getting updated.

so if anyone can suggest it will be helpfull.

can i use getHibernateTemplate.update()object instead of the above metioned will that work fine.

I am really new to this hibernate and if anyone can suggest me with any good tutorial to work with all hibernate related manipilations.

thank you very much in advance.

Harish.
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the object you 'update' doesn't have a primary key initialized, then Hibernate will want to create a new row representing that object.

Adding Records with Hibernate: A Simple Tutorial

-Cameron McKenzie
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!