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.