-->
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.  [ 2 posts ] 
Author Message
 Post subject: Lazy loading issue with composite primary keys
PostPosted: Mon Dec 07, 2009 12:03 pm 
Newbie

Joined: Wed Sep 12, 2007 4:13 pm
Posts: 4
Location: Atlanta
Hello,

I have two entities Enterprise and EnterpriseGroupDefault. Enterprise is the parent entity. EnterpriseGroupDefault has composite primary keys. Its mapping is given below:

Code:
   <class name="Enterprise" table="Enterprise">
      <id name="enterpriseId" column="EnterpriseID" />
      <property name="activeFlag" column="Active" />
      <property name="createdDate" column="dt_created" />
      <property name="createdBy" />
            
      <set name="enterpriseGroupDefault"  lazy="true" inverse="true">
         <key column="enterpriseId"  />
         <one-to-many class="EnterpriseGroupDefault"  />
      </set>
              <\class>
              <class name="EnterpriseGroupDefault" table="EnterpriseGroupDefaults" >
      <composite-id
         access="property" class="com.pgi.server.dao.enterprise.pk.EnterpriseGroupDefaultPK"
          mapped="true">
         <key-many-to-one name="enterprise" class="Enterprise"   column="enterpriseid"  />
         <key-property name="groupCode" />
      </composite-id>
      <property name="createdBy" />
      <property name="createdDate" column="dt_created" />
      <property name="isActive" column="Active" />
   </class>



Now when I execute session.createQuery("from Enterprise") HQL, it executes successfully but it also fetches the child entity(EnterpriseGroupDefault), which I do not want to happen. Can anyone suggest what is going wrong here?

Thanks
Shimit

_________________
SSM


Top
 Profile  
 
 Post subject: Re: Lazy loading issue with composite primary keys
PostPosted: Mon Dec 07, 2009 3:39 pm 
Newbie

Joined: Wed Oct 21, 2009 7:33 am
Posts: 11
Try using lazy="extra"


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

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.