Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Behaviour of saveOrUpdate()

 
Bhavik Patel
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using the following query to load the items



Now when i will try to update and save summary objects retrieved from above query with the following call
saveOrUpdate(summary)

will that also save and update details in side it or only summary objects??
 
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
saveOfUpdate will persist the state of any JPA annotated, or mapped, entity in your domain. Whether or not associated objects will be persisted depends upon how you've configured the CascadeType for the relationship.

Of course, if the objects are already associated with the Session's cache, all you'd need to do is update the POJO and commit the transaction.

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