Here's an excerpt of my code (I only copied the bits I think are relevant)
Code:
/**
* @hibernate.class table="bid"
*/
public class Bid {
private int id;
String title;
User user = new User();
Item item = new Item();
/**
* @hibernate.many-to-one column="user_id"
*/
public User getUser() {
return user;
}
/**
* @hibernate.many-to-one column="item_id"
*/
public Item getItem() {
return item;
}
}
/**
* @hibernate.class table="item"
*/
public class Item {
private int id;
private String name;
}
when I do a query like this:
Code:
"from Bid where user_id = :userId"
The query runs fine and the results are the expected ones. Still, I noticed that there are eight extra SQL's that fetch Items. I am not touching the items after the query, just calling bid.getTitle().
Initially I thought that it is fetching all the associated items but there are 13 corresponding items so it's fetching less.
Could anyone tell me what is the reason for the 8 requests?[/code]