onFlushDirty « Interceptor « JPA Q&A

1. Interceptor.onFlushDirty() is being called for inserts    forum.hibernate.org

Newbie Joined: Wed Oct 27, 2010 11:13 am Posts: 5 Hello- My interceptor's onFlushDirty() method is being invoked even for newly created entities. My understanding is onSave() is for inserts and onFlushDirty() for updates. Any pointers will be highly appreciated. Thanks. Code: public class AuditLogInterceptor extends EmptyInterceptor { /** * ...

2. recursion using Interceptor.onFlushDirty()    forum.hibernate.org

I tried to use an Interceptor to create protocol objects for changes made on persistent objects. Each protocol object maps the change of the state of a single property of the persistent object. Creating the protocol objects works very well with the Interceptor. Now I want to store the protocol objects to the database with session.save(protocol object) in onFlushDirty(). This causes ...

3. Interceptor.onFlushDirty not called    forum.hibernate.org

4. Interceptor.onFlushDirty called twice    forum.hibernate.org

5. Interceptor onFlushDirty()    forum.hibernate.org

Hibernate version: 2.1.7 Mapping documents: Code: ///////////////////////////////////////////////////////////////////// Session session = sessionFactory.openSession(conn, new TestInterceptor()); Transaction tx = session.beginTransaction(); Fred fred = (Fred) session.load(Fred.class, new Integer(1)); fred.setName("John"); //Each call to getNamedQuery forces a flush()!!! Query query = session.getNamedQuery("selectAgreedTrips"); query.list(); tx.commit(); session.close(); //////////////////////////////////////////////////////////////////// class TestInterceptor implements ...

6. Interceptor and mutiple calls onFlushDirty    forum.hibernate.org