I have an entity:
@Entity
@EntityListeners(MyEntityListener.class)
class MyEntity{ ... }
And the listener:
class MyEntityListener{
@PrePersist
@PreUpdate
public void doSomething(Object entity){ ... }
}
I'm using the Spring Data generated DAO for this entity (1.4.1) and EclipseLink. The code behavior is as follows:
MyEntity entity = new Entity();
entity = dao.save(entity); // the doSomething() is called here
// change something it the entity and save it again
dao.save(entity); // the doSomething() is NOT called here, checked with breakpoint
The problem has already been described by someone in 2009, however, they did not came up with any solution. I wonder if anyone has and idea how to solve it?