-->
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: Disabling lazy fetching
PostPosted: Fri Feb 04, 2011 2:40 pm 
Newbie

Joined: Fri Feb 04, 2011 2:29 pm
Posts: 1
Hey all,
...hope I'm posting in the right place. We're running Hibernate 3.0 and have disabled lazy loading for several collections on one class (See below for a section of .hbm.xml). My question is this. We want to have lazy loading disabled on all collections in all but one case, since we typically only get one instance of this class at a time. We recently had to write a job to dump tens of thousands of these rows to a log file for audit purposes (waste of bytes I know) and all we need are the fields off class. I can do a "sql report" with these fields but it would be better if I get the actual object and "enable" lazy loading for this class in this one-off instance. Is this posslbe?

<hibernate-mapping>
<class ...>
...company nonsense removed...
<many-to-one
name="tracker"
column="mainID"
class="MyCustomClass"
lazy="false"
insert="false"
update="false"/>


<property name="numComplete" type="java.lang.Integer">
<column name="Num_Complete" />
</property>

<property name="numItems" type="java.lang.Integer">
<column name="Num_Items" />
</property>

<property name="numNeedReview" type="java.lang.Integer">
<column name="Num_Need_Review" />
</property>

<property name="complete" type="boolean">
<column name="Complete" not-null="false" />
</property>

<property name="lastUpdate" type="timestamp">
<column name="Last_Update" not-null="true" />
</property>
...company nonsense removed...
</class>
</hibernate class>


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.