Hi All!
I am with a great problem and would like to count on the you aid.
I am trying to execute one query but the "intelligence" of hibernate confuses me a little.
Let us say that I have the following structure of classrooms:
Quote:
A.getId_A()
A.getName()
A.getB() >> return class B
B.getId_B()
B.getName()
If I to execute one query in hibernate in the following format:
Quote:
Select A.Id_A, A.Name, A.B.Id_B , A.B.Name, from A,B where B.Id_B = A.B.Id_B(+)
I would like that hibernate I generated the following one:
Quote:
TA >> TableA
TB >> TableB
Select TA.Id_TA, TA.Nam_TA, TA.Id_TB , TB.Nam_TB from TA,TB where TB.Id_TB = TA.Id_TB(+)
But, as use mapping of objects,
A.B.Id_B instead of A.Id_B, hibernate generates the following one:
Quote:
Select i1.Id_TA, i1.Nam_TA, i1.Id_TB , i2.Nam_TB from TA i1 , TB i2, TA i3 , TB i4 where i2.Id_TB = i1.Id_TB(+) and i3.Id_TB = i4.Id_TB
It is not my interest that the second part of where either added, nor that is added again from tables TA and TB.
Somebody knows as I can prevent that these to duplicate are generated or it suggests some alternative to me?
[]`s[/quote]