listener « Update « JPA Q&A





1. listener for jpql update    forum.hibernate.org

Hi, If I am using a jpql update statement, something like: String q = "update Table a set a.column = :t where a.id = 471"; Query query = em.createQuery(q); query.setParameter("t", "test"); int rowCount = query.executeUpdate(); Is there any way I could listen when the entity Table is updated? The Post-Update event listener that I create for entity Table does not seem ...

2. Modifying persistent object references within a listener    forum.hibernate.org

Hibernate version: 3.1.3 Database: PostgreSQL 8.1.4 Hello, Our object model is similar to the composite pattern (Class Xyz contains references to other Xyz), and we would like to configure a save/insert listener so that the listener runs for each instance in an object graph. (My main question is below, however). Domain model Example: Code: public class Xyz { private ...

3. AuditLogging, cannot configure listeners in persistence.xml    forum.hibernate.org

First, what's my goal I want to do an audit log. I read the http://www.hibernate.org/318.html and there two different approaches were mentioned. The first is using a Listener. The second is using the new eventing model in Hibernate3. The author said that he couldn't make the eventing approach work for an unknown reason. I'm using Hibernate via JPA. I'm using it ...

4. DeleteAction not executed when calling em.remove in listener    forum.hibernate.org

public class CustomCascadePreDeleteListener implements PreDeleteEventListener { public boolean onPreDelete(PreDeleteEvent event) { Object entity = event.getEntity(); List relatedEntities = getRelatedEntities(entity); for (Object relatedEntity : relatedEntities) event.getSession().delete(relatedEntity); ...