• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hibernate saveUpdate problem

 
sachin yadav
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a pojo as :



my hbm file is:


my DAO is:


So my POJO will populate values out of a hash map "dynamicPropertiesMap" and save it in case a new entry or update in case if propertyId already exists. But problem is that save is never fired and always an update is fired by DAO. Can anyone please tell me the problem?
 
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
Why not just use Hibernate's saveOrUpdate method? If it is a new entity, Hibernate will save it. If it is not a new entity, Hiberante will update the associated record. It makes live very easy!

-Cameron McKenzie
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic