My code loads a collection of entities using findall(class). The em is left
open rather than having to open and close it every time the user performs an
operation on one of these objects in the list.
Below is my PreUpdate listener for that entity, so I know when it is getting
called I have system.out right now.
The problem is that if I use em.merge(entity) the PreUpdate listener will
be called on each one of the entities in the list not only the entity I am
merging. If I close the em and create a new one then call em.merge(entity),
the PreUpdate listener will only be called on the entity I am merging.
@PreUpdate
public void update(){
System.out.println("Running preupdate dataload listener");
this.updateCounters();
}
I expected this would be due to runtime enhanced classes so didn't pay much
attention to it, but now I have being using it after build time enhancing
my classes I have the same issue. It seems like it wants to run the
PreUpdate listener on anything of this entity class that is attached to the
current em.
Have anyone seen this before?
Chris