org.hibernate.AssertionFailure: collection [com.opterus.opscenter.model.common.Brand.regions] was not processed by flush()

Hibernate JIRA | Ian Long | 9 years ago
  1. 0

    Using the event listeners(pre-update,pre-insert) in hibernate, a problem occurs when validating a lazy collection of composite-elements. I was using the @Size validator, but I'm sure others will cause the same problem. For example: <set name="activatedModules" lazy="true" table="location_module_activation"> <key column="location_id" /> <composite-element class="com.opterus.opscenter.model.module.ActivatedModule" > <property name="activationDate" column="activate_date" not-null="true" /> <many-to-one name="module" class="com.opterus.opscenter.model.module.Module" column="module_id" not-null="true" unique="false" /> </composite-element> </set> will cause an exception during flush: 01:53:55,587 ERROR [http-8080-Processor23] AssertionFailure:22 - 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 [com.opterus.opscenter.model.common.Brand.regions] was not processed by flush() at org.hibernate.engine.CollectionEntry.postFlush(CollectionEntry.java:205) at org.hibernate.event.def.AbstractFlushingEventListener.postFlush(AbstractFlushingEventListener.java:333) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:28) Since it tries to access the proxied collection. A collection of entity objects does not cause this problem. I guess the composite-element is handled differently than regular collections? Filed at the request of emmanuel, from the following thread: http://forum.hibernate.org/viewtopic.php?p=2361829#2361829

    Hibernate JIRA | 9 years ago | Ian Long
    org.hibernate.AssertionFailure: collection [com.opterus.opscenter.model.common.Brand.regions] was not processed by flush()
  2. 0

    Using the event listeners(pre-update,pre-insert) in hibernate, a problem occurs when validating a lazy collection of composite-elements. I was using the @Size validator, but I'm sure others will cause the same problem. For example: <set name="activatedModules" lazy="true" table="location_module_activation"> <key column="location_id" /> <composite-element class="com.opterus.opscenter.model.module.ActivatedModule" > <property name="activationDate" column="activate_date" not-null="true" /> <many-to-one name="module" class="com.opterus.opscenter.model.module.Module" column="module_id" not-null="true" unique="false" /> </composite-element> </set> will cause an exception during flush: 01:53:55,587 ERROR [http-8080-Processor23] AssertionFailure:22 - 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 [com.opterus.opscenter.model.common.Brand.regions] was not processed by flush() at org.hibernate.engine.CollectionEntry.postFlush(CollectionEntry.java:205) at org.hibernate.event.def.AbstractFlushingEventListener.postFlush(AbstractFlushingEventListener.java:333) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:28) Since it tries to access the proxied collection. A collection of entity objects does not cause this problem. I guess the composite-element is handled differently than regular collections? Filed at the request of emmanuel, from the following thread: http://forum.hibernate.org/viewtopic.php?p=2361829#2361829

    Hibernate JIRA | 9 years ago | Ian Long
    org.hibernate.AssertionFailure: collection [com.opterus.opscenter.model.common.Brand.regions] was not processed by flush()
  3. 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()
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Grails GORM gives hibernate exception when querying domain object that was already queried

    Stack Overflow | 10 months ago | Sergei Ledvanov
    org.hibernate.AssertionFailure: collection [com.mydomain.InnerObject.assignedTests] was not processed by flush()
  6. 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()

  1. musketyr 4 times, last 1 month ago
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.opterus.opscenter.model.common.Brand.regions] was not processed by flush()

    at org.hibernate.engine.CollectionEntry.postFlush()
  2. Hibernate
    CollectionEntry.postFlush
    1. org.hibernate.engine.CollectionEntry.postFlush(CollectionEntry.java:205)
    1 frame
  3. Hibernate
    DefaultFlushEventListener.onFlush
    1. org.hibernate.event.def.AbstractFlushingEventListener.postFlush(AbstractFlushingEventListener.java:333)
    2. org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:28)
    2 frames