pierre-henry perret (1) [Avatar] Offline
#1
At the present time, we are using Hibernate 2.1.
All our mapping uses the “lazy=true” mode.
In the Java Code, to avoid multiple “select” to get information on a class, we use the “fetchMode.eager” in the criteria query or the “left join fetch” in an HQL query.
In works fine except in one case :

Select from Vehicule v left join fetch v.start s left join fetch v.arrival a


when both class “start” and “arrival” are stored in the same database table.
<class name="Vehicule" table="VEHICULE" lazy="true">
<many-to-one name="start" column="start" class="HbSite" cascade="none" not-null="true"/>
<many-to-one name="arrival" column="arrival" class="HbSite" cascade="none" not-null="true"/>


In that case, the generated SQL does not have 2 joins but only one. So, in the java code, hibernate need to execute many SQL query If we need a property of the object “start”.
Does hibernate 3 fixes this problem ?
Thanks.

Message was edited by:
pierre-henry perret

Message was edited by:
Vincent Delhommois

null