Hi,
I'm new using Hibernate 2.1.2, and I'm experiencing a performance problem.
I have two tables, Address and City, and they have a relationship "many-to-one" in the Address mapping file:
Code:
<many-to-one
name="city" class="com.test.hibernate.City"
not-null="true">
<column name="ID_CITY" />
</many-to-one>
When I retrieve the complete list of the Address object with the command:
Code:
hibSession.find("select add from Address add where add.id < 300 ")
Looking to the log i have seen that hibernate execute an initial query with the Select command on the table Address and then execute another query for each distinct City.
If I modify the query command in
Code:
hibSession.find("select add, add.city from Address add where add.id < 300 ")
it load the same object of type ind, but execute only a query with the correct join operator (inner or outer based on mapping).
Why this?
Is a behaviour by design or is a bug?
I would like that each object was loaded with a single SQL query... Can i control this with configuration parameter?
TIA,
Franco