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.  [ 2 posts ] 
Author Message
 Post subject: Nhibernate issues with a complex(?) map?
PostPosted: Wed Jun 06, 2007 7:53 am 
Newbie

Joined: Wed Jun 06, 2007 7:31 am
Posts: 1
Hibernate V1.2

The map is too big to list here but for the overall picture
Meetings is the primary object
Each Meeting Has (N) Ballots
Each Ballot has (N) ProposalGroups
Each ProposalGroup has (N) Proposals

NO lazy loading is enabled

A join of every table for this query will result in 4700 records.

Issue #1) I Tried to use <bag> but a bag within a bag was throwing an exception.

Issue #2) Using <list> mappings and HQL I can make it work up to ProposalGroup. As soon as I add on LEFT JOIN fetch Propsals it crashes after about a minute due to excessive memory usage. The query is:
"from MeetingList as ml LEFT JOIN fetch ml.Ballots as b LEFT JOIN fetch
b.ProposalGroups as pg LEFT JOIN fetch pg.Proposals"


Issue #3) I tried to make nhibernate work with my own createSQLQuery but I cannot make it map over the sub collections. If I do it this way, I get 4700 meeting objects when it should really only be 750. Is there a way to do the same functionality that HQL gives you via your custom sql query?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 20, 2007 5:18 am 
Beginner
Beginner

Joined: Thu Oct 26, 2006 4:45 am
Posts: 39
If you are getting more objects than you expected, maybe you are getting the same object multiple times because of the joins?

If you retrieve objects using Criteria, have you used

Code:
criteria.SetResultTransformer(new NHibernate.Transform.DistinctRootEntityResultTransformer());


?

Cheers,


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