-->
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 EAGER fetching problem
PostPosted: Thu Apr 13, 2006 11:54 am 
Newbie

Joined: Tue Mar 15, 2005 7:37 am
Posts: 16
I have a question regarding Eager fetching and the SQL-strategy used by Hibernate (I'm using annotations).

I have a hierarchy of Entitys mapped to diffrent tables:

Code:
class A { }

class B extends A { }


when I do a query over the main-entity I get (as expected) a list of instaces of diffrent types (A and B).

Each of the types are also mapped to diffrent 'type' entitys like with many-to-one:

Code:
class A {
  @ManyToOne(fetch = FetchType.EAGER)
  private RegionType regionType;
}


when doing like this I expected that the "RegionType" should be fetched in the same database query as the Entity with this Annotation (A above) but it is not. Instead I get one sql-query fething the RegionType for each fetched A. Since I fetch quite many A and I also use the RegionType for each A (so LAZY is not really an option) this renders very many sql-querys, not that good .. so ...

Is this how it is? Is there any way to get Hibernate to join the RegionType with the main sql query?

Thanks,
/Magnus


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.