isDirty « Session « JPA Q&A





1. Invoke of onFlushDirty caused by Session.isDirty    forum.hibernate.org

Hi all, I have an interceptor-class for audit-logging. This works very well. Today I refactored some code and I inserted the following statement. Just for my understanding - is it the normal behaviour that a call getSession().isDirty() do cause an invocation of the interceptor method onFlushDirty() ? I thought that a flush() is needed to get into this interceptor-method? Is it ...

2. Should Session.isDirty() flushes data?    forum.hibernate.org

Hello, Hibernate team. When calling Session.isDirty() (Hibernate 3.0.0, non-classic) it looks like DefaultDirtyCheckEventListener performs actual flush. I'm not sure is this an intended behaviour. In fact, javadoc for Session.isDirty() says that it should only check are there any pending changed and would database update happen on Session.flush(). Please advise. Thank you. Best regards, Maxim.

4. Session.isDirty() perfoms save ?    forum.hibernate.org

Hi, When calling Session.isDirty() (Hibernate 3.0.5, non-classic) Hibernate performs implicitly a save and generates the SQL for retrieving the new id (from the sequence). Here is my example: Session ses=SessionManager.currentSession(); TblDocumenti doc = (TblDocumenti)ses.load(TblDocumenti.class, new Long(506)); TblSequenze seq = (TblSequenze)TblSequenze.class.newInstance(); seq.setDoc(doc); seq.setSezione(new Short("2")); doc.getTblSequenze().add(seq); // if you omit the following line the id is retrieved when calling flush if (ses.isDirty()) {System.out.println("isDirty");} ...

5. session.isDirty() bug??    forum.hibernate.org

I read this chapter, but there is not mentioned that is correct behaviour that a call to session.isDirty performs save. The problem is that when i call session.isDirty a save operation is fired even if it's not necessary. Here is my short example: Posted: Thu Oct 27, 2005 2:13 pm Post subject: Session.isDirty() perfoms save ? Hi, When calling Session.isDirty() (Hibernate ...

6. Why is the Session.isDirty methnot working as I would expect    forum.hibernate.org

I have a detached object. I make changes to the detached object. I then reattach the object using session.lock(LockMode.NONE) I then call session.isDirty() and expect to get a "true" result but I get "false" even though the object is dirty. Once I have the session open and then make changes to the object, I can call isDirty and get a "true" ...

7. Session.isDirty returns true but not sql gets executed    forum.hibernate.org

Hi, the example code returns true for session.isDirty (as expected) but no sql will be executed. try { tx = session.beginTransaction (); // creating a many-to-many for two persistent entities System.out.println(session.isDirty ()); tx.commit (); } catch (Exception e) { if (tx != null) { tx.rollback (); } } finally { session.close (); } Are there any know conditions for that behaviour, ...

8. Session flush when calling isDirty()    forum.hibernate.org