[hibernate-issues] [Hibernate-JIRA] Created: (HV-37) Validating a lazy collection of composite-elements causes flush problem

Ian Long (JIRA) noreply at atlassian.com
Fri Aug 10 11:39:13 EDT 2007


Validating a lazy collection of  composite-elements causes flush problem
------------------------------------------------------------------------

                 Key: HV-37
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-37
             Project: Hibernate Validator
          Issue Type: Bug
    Affects Versions: 3.0.0.ga
         Environment: Hibernate 3.2.4ga
Hibernate Annotations 3.3.0.ga
mysql 5.0.27
            Reporter: Ian Long


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

-- 
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