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
but i cannot tell the difference.
posted 6 years ago
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.