-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate lazy-loading and many-to-many associations
PostPosted: Sat Nov 07, 2009 12:05 pm 
Newbie

Joined: Sat Nov 07, 2009 11:38 am
Posts: 2
Hi,

Problem 1 :
I'm developping a bank system, and I need to load operations relying on a customer.
At first, I m interesting to customers, so I do not need operations, I have choosen the lazy loading for operations set.
But once I want to get a customers operations, I need to limit them, of course, because each one, can have many thousands ones.

So, can I specify the objects loaded number ? or, there is an other easier way ?

Problem 2:
I have in my database a many-to-many association between two tables, so realy, I have 3 three table with two associations many-to-one, many-to-one.

Exemple :

Group stydies in a classroom.
Group can study in many classroom, and in a classroom, many group can study, in my database, I need to have three table (I suppose that my server does not support many-to-many relations) Group, ClassRoom and Study.

in this case, study will have some informations, such as time, professor, ...

in my mapping files, I will have on the both sides something like :

<set name="" table="">
<key column=""/>
<many-to-many column=""
class=""/>
</set>

My question is, in witch mapping-file and how can I map the others fields of Study table ?

Thank's.
Best regards.


Top
 Profile  
 
 Post subject: Re: Hibernate lazy-loading and many-to-many associations
PostPosted: Tue Nov 10, 2009 5:34 am 
Expert
Expert

Joined: Thu Jan 08, 2009 6:16 am
Posts: 661
Location: Germany
Problem 1: http://docs.jboss.org/hibernate/stable/core/reference/en/html_single/#performance-fetching-initialization

Problem 2: http://docs.jboss.org/hibernate/stable/core/reference/en/html_single/#assoc-bidirectional-join-m2m

Hope that helps.

_________________
-----------------
Need advanced help? http://www.viada.eu


Top
 Profile  
 
 Post subject: Re: Hibernate lazy-loading and many-to-many associations
PostPosted: Tue Nov 10, 2009 6:59 am 
Newbie

Joined: Sat Nov 07, 2009 11:38 am
Posts: 2
Hi,

The second problem is still persisting, I have an other informations plus the foreign keys, so where can I mapp them, a classical solution consists of mappin this many-to-many association to two associations many-to-one, so we will have three mapping class in stead of two.

I didn't prefer this solution, it does not seem an object one, but it works.

Thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.