These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Lazy collection in a many-to-many scenario
PostPosted: Tue Aug 08, 2006 4:45 am 
Regular
Regular

Joined: Tue Aug 08, 2006 4:28 am
Posts: 96
Location: Hong Kong
Is it possible to make both end of a bidirectional many-to-many relation as a lazy collection. I marked both <set> with lazy="true" but only one end is lazy initialized.

Here is my mapping files.
Only Group.Users behaves as a lazy collection.

Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
    <class name="My.User, My" table="SecUser" dynamic-update="true" dynamic-insert="true" optimistic-lock="dirty">
        <id name="KeyId" column="KeyId" type="Int32">
            <generator class="assigned" />
        </id>
        <property name="UserName" type="String" length="50" />
       
        <set name="Groups" access="NHibernate.Generics.GenericAccessor+CamelCase, NHibernate.Generics" table="SecMapUserGroup" inverse="false" lazy="true">
            <key column="SecUserKeyId" />
            <many-to-many class="My.Group, My" column="SecGroupKeyId"/>
        </set>
    </class>
</hibernate-mapping>


Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
    <class name="My.Group, My" table="SecGroup" dynamic-update="true" dynamic-insert="true" optimistic-lock="dirty">
        <id name="KeyId" column="KeyId" type="Int32">
            <generator class="assigned" />
        </id>
        <property name="GroupName" type="String" length="50" />
       
        <set name="Users" access="NHibernate.Generics.GenericAccessor+CamelCase, NHibernate.Generics" table="SecMapUserGroup" inverse="true" lazy="true">
            <key column="SecGroupKeyId" />
            <many-to-many class="My.User, My" column="SecUserKeyId"/>
        </set>
    </class>
</hibernate-mapping>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.