-->
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: many-to-many assosiation and performance
PostPosted: Wed May 31, 2006 1:27 pm 
Beginner
Beginner

Joined: Tue Jan 04, 2005 5:39 am
Posts: 37
Hibernate version:3.0.5

Hi,

Here is my model:

Code:
class A {
     Set<B> bs;

     // many-to-many
     Set<B> getBs() {return bs;}
}

class B {
     Set<A> as

     // many-to-many
     Set<A> getAs() {return as;}   
}


When I'm calling a.getBs() method hibernate generates the following query:

Code:
select ...
from a_to_b a2b, b
where a2b.b_id = b.id and
a2b.a_id = XXX


My problem is: a_to_b table appears first in the from clause. This unbelievably harms Oracle's performance (don't ask why :), its a long story...)

My question are:
1. Can I control the way in which this query is created from code or mappings?
2. If not, can I somehow define to hibernate custom query which will handle this association?
3. If not, what can I do? :)

Thanks a lot!
Michael.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 31, 2006 2:46 pm 
Regular
Regular

Joined: Thu Sep 22, 2005 1:53 pm
Posts: 88
Location: Rio de Janeiro
Not sure if this will help to solve your problem but there is a way
to inform a query for loading a collection.... but I think it onlu works
with the session.load(...) method
take a look at:

SQL for loading

_________________
DonĀ“t forget to rate!


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 04, 2006 1:16 pm 
Beginner
Beginner

Joined: Tue Jan 04, 2005 5:39 am
Posts: 37
Thanks!

I looked at the hibernate3.pdf which was probably not finished in 3.0.5 !!! :-)

This part was missing from it!


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.