-->
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: Bi-directional many-to-many. Lazy=true only on one side?
PostPosted: Wed Jun 20, 2007 6:57 am 
Newbie

Joined: Wed Jun 20, 2007 6:44 am
Posts: 2
I have a bi-directional many-to-many where I basically want lazy loading only from "one side". My Product class has a set of services, and my Service class has a set of products.

The code I develop here is used as a library, one client is a web client, and we use the opensessioninviewinterceptor mechanism in Spring. The other client is a standalone Java app (where we do not want laziness). The Java App will never call product.getServices(), so it should not be a problem.

Here is an exctract from my mappings.

product mapping:
Code:
<set name="services" lazy="true" inverse="true" .......
   <key column....
   <many-to-many colu....
</set>

service mapping:
Code:
<set name="products" lazy="false"  .......
   <key column....
   <many-to-many colu....
</set>

If I access service.getProducts() I get a LazyInitializationException in my standalone JavaApp.

My question is: Is it posssible with a bi-directional many-to-many to have lazy=true on one side, and lazy=false on the other side? Does it make sense?


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.