There are two occasions when hibernate will ‘hydrate’ an object as null. Suppose you are tracking data about people, storing name, address and demographic information. Your classes might look like this:
public class Person {
private Name name;
private List
… other items …
public Person() {}
//no-argument constructor required by Hibernate.
… setters and getters …
}
public class Name{
private String firstName;
private String lastName;
--- other items ---
}