This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Update Caos

 
Jorge Bendahan
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, I have an object "A" than contains a Collection of objects "B" and a collection of objects "C". Every time i merge an atribute of A, i noticed that the persistence provider creates a lots of select statements, it´s getting really slow. I have tried the following:

Change from this


to this


but i cannot tell the difference.
 
James Sutherland
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is your provider, and what are the SQL statements?

In JPA merge will always merge references, but only cascade the merge to the related objects if set to cascade. i.e. the collection will always be merged, but the objects in the collection will only be merged if cascading. There is no way in JPA to not merge the collection references, (unless it is lazy and not instantiated), other than manually merging the objects. If you are using EclipseLink the EclipseLink API also provides a shallowMerge and a merge without references.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic