[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-1663) <any/> with collection will produce "AssertionFailure: collection was not processed by flush()"

Steve Ebersole (JIRA) noreply at atlassian.com
Tue Oct 17 10:54:25 EDT 2006


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1663?page=all ]

Steve Ebersole updated HHH-1663:
--------------------------------

        Summary: <any/> with collection will produce "AssertionFailure: collection was not processed by flush()"  (was: <any> mapping will produce AssertionFailure: collection was not processed by flush())
    Fix Version: 3.2.1
      Assign To: Steve Ebersole

The scenario is that you have an <any/> mapping where the reference is an entity with a mapped collection.  The situation is that during flush, AnyType calls into SessionImplementor.bestGuessEntityName() which in turn forces the entity to initialize.  However, it is being initialized in the midts of a flush.  The solution is to not initialize the proxy in bestGuessEntityName()...

> <any/> with collection will produce "AssertionFailure: collection was not processed by flush()"
> -----------------------------------------------------------------------------------------------
>
>          Key: HHH-1663
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1663
>      Project: Hibernate3
>         Type: Bug

>   Components: core
>     Versions: 3.0.5, 3.1.3
>  Environment: Hibernate 3.1.3, Oracle 9.0.1
>     Reporter: Robert Herschke
>     Assignee: Steve Ebersole
>      Fix For: 3.2.1
>  Attachments: AssertionFailureTest.zip
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list