Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Bonni Garcia   on Aug 02 In Java Category.

  
Question Answered By: Ray Lawrence   on Aug 02

To use saveOrUpdate() function of hibernate  you have to set attribute of your PK to "increment" in hbm.xml file related to your pojo.
when you try to use this function , note that not to set the primary key  and either in editing mode just fetch it from db once.
the hibernate checks the value of PK and decides to insert or edit a record itself.
the key point is that u use the correct style for PK which is "increment" in this case.

Share: 

 
 
Didn't find what you were looking for? Find more on hibernate SaveUpdate Or get search suggestion and latest updates.


Tagged: