org.hibernate.AssertionFailure: collection [com.olympe.model.ObjetBI.votes] was not processed by flush()

  1. 0

    collection was processed twice by flush()

    Stack Overflow | 4 months ago | Djidji Ndiandia
    org.hibernate.AssertionFailure: collection [com.olympe.model.ObjetBI.votes] was not processed by flush()
  2. 0

    The problem occurs when insert or update listener is created on hibernate session on model with many-to-many collection and listener is making some queries with this model. The listener is needed for checking data integrity , so I need to make some select clauses within this listener. That is my code from PreInsertEventListener.onPreInsert() method (some lines were removed for clearance) : //I set this on FlushMode.NEVER because StackOverflowError is thrown event.getSession().setFlushMode(FlushMode.NEVER); // Function below makes database query using criteria API String o = listener.validate(event.getEntity(),event.getSession()); if (o != null) { // I don't know if this is correct, but why not?? I don't catch this exception in my code and I have auto_close_session and auto_flush_session on true throw new ConstraintViolationException(o,null,null); } // set to default settings event.getSession().setFlushMode(FlushMode.AUTO); That's exception from my WebLogic 8.1 server <2005-05-05 18:05:15 CEST> <Error> <org.hibernate.AssertionFailure> <000000> <an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session) org.hibernate.AssertionFailure: collection was not processed by flush() at org.hibernate.engine.CollectionEntry.postFlush(CollectionEntry.java:144) at org.hibernate.event.def.AbstractFlushingEventListener.postFlush(AbstractFlushingEventListener.java:305) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:28) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:678) at pl.softbank.cepik.modris.common.client.util.DefaultModrisClient.updateObject(DefaultModrisClient.java:196) at pl.softbank.cepik.modris.dict.common.client.CommonDictModrisClient.insert(CommonDictModrisClient.java:71)

    Hibernate JIRA | 1 decade ago | Tom Kucharski
    org.hibernate.AssertionFailure: collection was not processed by flush()
  3. 0

    I have the following mapping: <class name="A"> <id name="idx"> <generator class="uuid"/> </id> <property name="test"/> <any name="any" id-type="string" meta-type="string" cascade="none"> <column name="any_type"/> <column name="any_id"/> </any> </class> and: <class name="B"> <id name="idx"> <generator class="uuid"/> </id> <set name="as"> <key column="B_as_idx" not-null="false"/> <one-to-many class="A"/> </set> </class> Now I do the following: At first I like to create some objects: Session s = sf.openSession(); Transaction tx = s.beginTransaction(); A a = new A(); Serializable idx = s.save(a); B b = new B(); s.save(b); a.setAny(b); s.update(a); b.getAs().add(a); s.update(b); tx.commit(); s.close(); At next I like to modify A: s = sf.openSession(); tx = s.beginTransaction(); A a2 = (A)s.get(A.class, idx); a2.setTest("hallo!"); s.update(a2); tx.commit(); s.close(); And it crashes at the second commit() with: Exception in thread "main" org.hibernate.AssertionFailure: collection was not processed by flush() at org.hibernate.engine.CollectionEntry.postFlush(CollectionEntry.java:144) at org.hibernate.event.def.AbstractFlushingEventListener.postFlush(AbstractFlushingEventListener.java:305) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:28) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730) at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:324) at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86) at test.Test.main(Test.java:53) I've attached a testcase, but please change the hibernate.ora.cfg.xml with your parameters.

    Hibernate JIRA | 1 decade ago | Robert Herschke
    org.hibernate.AssertionFailure: collection was not processed by flush()
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    [1.3.0] When did you plan to release it

    Google Groups | 4 years ago | Alex
    org.hibernate.AssertionFailure: collection [models.User.tags] was not processed by flush()
  6. 0

    Different behaviour of Grails association

    Stack Overflow | 2 years ago
    org.hibernate.AssertionFailure: collection [com.org.Favorite.persons] was not processed by flush()

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.hibernate.AssertionFailure

      collection [com.olympe.model.ObjetBI.votes] was not processed by flush()

      at org.hibernate.engine.spi.CollectionEntry.postFlush()
    2. Hibernate
      SessionImpl.managedFlush
      1. org.hibernate.engine.spi.CollectionEntry.postFlush(CollectionEntry.java:231)
      2. org.hibernate.event.internal.AbstractFlushingEventListener.postFlush(AbstractFlushingEventListener.java:382)
      3. org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:57)
      4. org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1222)
      5. org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:425)
      5 frames