-->
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: Fetch Join / SUBSELECT doesn't work
PostPosted: Tue Jun 17, 2008 8:19 am 
Newbie

Joined: Tue Jun 17, 2008 7:45 am
Posts: 4
Dear all,

I'm a bit curious why Hibernate doesn't do fetch join or subselect when I told it to do so.

I have an entity T with some subclasses (T1, T2 ...) mapped using Joined inheritance. T has one-to-one relationship with another entity U using:

Code:
@ManyToOne(fetch=FetchType.EAGER)


From the document, if I retrieve T, U should be retrieved with T by using join. However, Hibernate is using another select to get U.

My query is like:

Code:
"select t from T where ... order by ..."


and I get one select for U for each T returned from the above query.

I try to change the query to:

Code:
"select t from T left join fetch t.u where ... order by ..."


and:

Code:
"select t from T fetch all properties where ... order by ..."


but Hibernate is still doing the same.

I try to add
Code:
@Fetch(FetchMode.JOIN)
to the association, but it doesn't help (nor does BatchSize).

There is another relation on U to V (ManyToMany Set) that has similar problem. On this relation, @FetchMode doesn't work (both JOIN and SUBSELECT), but @BatchSize do work.

Is this Hibernate's optimization for DB2 or I am doing something wrong?

I'm using:
- Hibernate 3.2.6
- Hibernate EntityManager 3.3.2
- DB2Dialect, DB2 Express-C v9

Thank you in advance,
Pongtawat


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 17, 2008 8:32 am 
Newbie

Joined: Tue Jun 17, 2008 7:45 am
Posts: 4
Hello again,

It's mistake, actually "left join fetch" does work as expected.

However FetchMode still doesn't.

Thank you,
Pongtawat


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 17, 2008 11:22 pm 
Newbie

Joined: Tue Jun 17, 2008 7:45 am
Posts: 4
Any idea?

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.