-->
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="false" not work for whole class
PostPosted: Mon Dec 25, 2006 10:46 pm 
Beginner
Beginner

Joined: Sat Dec 16, 2006 1:52 pm
Posts: 40
I have this mapping
Code:
<hibernate-mapping>
  <class name="com.rgdsft.hibernate.core.models.DBContainerGraphic" lazy="false">
    <id name="id" type="long">
       <generator class="native"/>
   </id>
   <list name="containables" access="field" lazy = "false">
      <key column="ContainerID" not-null="true"/>
      <list-index column="sortOrder"/>
      <one-to-many class="com.rgdsft.hibernate.core.models.DBContainableGraphic"/>
   </list>
  </class>
</hibernate-mapping>


As you can see, in the class tag I have lazy="false". I figured that this would disable lazy loading for everything as the documentation implies. But then I got a lazy loading exception. So I had to set lazy="false' explicitely on the list itself. Now I do not get the lazy exception.

Did I misunderstand the class level lazy="false' setting??


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 26, 2006 12:08 am 
Regular
Regular

Joined: Wed Jul 27, 2005 2:33 am
Posts: 118
You have set it at the wrong place. You should set the "default-lazy" attribute of the <hibernate-mapping> element. It should be:

Code:
<hibernate-mapping default-lazy="false" >
  <class name="com.rgdsft.hibernate.core.models.DBContainerGraphic" >
    <id name="id" type="long">
       <generator class="native"/>
   </id>
   <list name="containables" access="field" >
      <key column="ContainerID" not-null="true"/>
      <list-index column="sortOrder"/>
      <one-to-many class="com.rgdsft.hibernate.core.models.DBContainableGraphic"/>
   </list>
  </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.  [ 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.