-->
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: many-to-one lazy initialization
PostPosted: Thu Nov 09, 2006 10:48 pm 
Newbie

Joined: Sat Apr 15, 2006 10:05 pm
Posts: 2
3.0.5:

Mapping Classes:

Film:
<joined-subclass extends="IP" name="Film" table="film">
<key column="id"/>
<set name="rightsMatrix"
cascade="save-update" inverse="true" lazy="true">
<key column="film_id"/>
<one-to-many class="FilmRight"/>
</set>
<set name="filmMedia"
cascade="all-delete-orphan" inverse="true" lazy="true">
<key column="film_id"/>
<one-to-many class="FilmMedia"/>
</set>
</joined-subclass>

Film Media:
<class name="FilmMedia" table="film_media">
<id name="id" column="id" type="long" unsaved-value="0">
<generator class="hilo"/>
</id>
<many-to-one name="film" class="Film" column="film_id"/>
</class>

Film Rights Matrix:
<class name="FilmRight" table="film_rights_matrix">
<id name="id" column="id" type="long" unsaved-value="0">
<generator class="hilo"/>
</id>
<many-to-one name="film" class="Film" column="film_id"/>

</class>

Code:
Film f = Session.load(...);

As expected, loading film does not load rights Matrix nor film media
since lazy="true"

Problem:
f.getFilmMedia(); loads rights matrix, I am puzzled that rights are getting loaded when lazy is set to true.

How to force lazy for many-to-one associations?


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.