-->
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: Why Hibernate does load ?
PostPosted: Tue Sep 16, 2008 4:45 pm 
Newbie

Joined: Tue Sep 16, 2008 4:27 pm
Posts: 2
Hibernate version: 3.0

Hi, I'm newbie in Hibernet. I hope someone can help. (Sory by my English).

I have 2 hbm:

This is mappping from ClassA
----------------------------------
<id name="id"
column="id" >
<generator class="sequence">
<param name="sequence">sec_problema_episodio</param>
</generator>
</id>

<property name="zone"
update="true"
insert="true"
column="zone"
not-null="true" />

<many-to-one
name="classB"
class="ClassB"
property-ref="nroHistory"
column="nro_history"
cascade="none"
not-null="true"/>

This is mappping ClassB
-----------------------------
<id name="id"
column="id" >
<generator class="identity"></generator>
</id>

<property name="nroHistory"
update="true"
insert="true"
column="nro_history"
unique="true"
not-null="true" />



So... the problem is that when I get a list of ClassA, for example:

return Hibernation.getSession().createCriteria(ClassA.class)
.add(Restrictions.eq("zone", "A"))
.list();

Hibernate DOES a load for each element of ClassA that the List containt. If the List get ten elements of ClassA, then Hibernate DOES ten load of ClassB.


Why does these loads ?. I didn't need these load.


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.