Hibernate version: 3.2.6
In the reference documentation it says:
"By default, Hibernate3 uses lazy select fetching for collections and lazy proxy fetching for single-valued associations"
Has the fetching strategy for single-valued associations changed in version 3.2.x?
I use the following example:
Code:
@Entity
public class Customer {
@Id
@GeneratedValue
private int id;
private String name;
@OneToMany
@JoinColumn (name="clientid")
private Collection<CreditCard> creditCards = new ArrayList();
@OneToOne
@JoinColumn (name="addressid")
private Address address;
Then when I execute the following code in the debugger:
Code:
java.util.List list = session.createQuery("from Customer").list();
or
Code:
Customer client = (Customer) session.get(Customer.class, id);
in both cases the address field is not a proxy, but the address object contains all address information from the database. So the address is eager loaded.
I know that this is the default behaviour for JPA, but is this also the default behaviour of hibernate?
If yes, then the reference documentation is not correct.
If no, then why do I get this behaviour in my example program?
Thanks,
Rene