[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2878) LazyInitializationException - no session or session was closed

Paul Andrews (JIRA) noreply at atlassian.com
Wed Oct 3 10:55:24 EDT 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2878?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_28335 ] 

Paul Andrews commented on HHH-2878:
-----------------------------------

BTW. A work-around for the attached test case is:

Change:

        <set name="threes" lazy="true" table="two">
        	<key property-ref="value" column="t_o_val_fk" />
        	<many-to-many column="t_f_id_fk" class="bug.hibernate.Three"/>
        </set>

To:
        <set name="threes" lazy="true">
        	<subselect>
        		(select distinct o.o_id_pk, f.f_id_pk from
        		 ONE o, TWO t, THREE f
       				where
       				t.t_o_val_fk = o.o_val and
       				t.t_f_id_fk = f.f_id_pk)
        	</subselect>
        	<key column="o_id_pk"/>
        	<many-to-many column="f_id_pk" class="bug.hibernate.Three"/>
        </set>


> LazyInitializationException - no session or session was closed
> --------------------------------------------------------------
>
>                 Key: HHH-2878
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2878
>             Project: Hibernate3
>          Issue Type: Bug
>    Affects Versions: 3.2.5
>         Environment: Hibernate v 3.1.4-3.2.5, Oracle/HSQLDB/Whatever
>            Reporter: Paul Andrews
>         Attachments: testcase.zip
>
>
> A LazyInitializationException is thrown for a lazy set when the items in the set can be duplicates. This is manifested in a many-to-many implemented using join table; the session is still open but the session for the collection is set to null.
> The attached ZIP contains a test-case that demonstrates this.

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