Suppose I have following class,
Code:
public class Event {
private Long id;
private String name;
private Date startDate;
private int duration;
private Set speakers;
private Set attendees;
private Location location;
}
Code:
<class name="com.manning.hq.ch05.Event" table="events">
<id name="id" type="long" unsaved-value="null">
<generator class="native"/>
</id>
<property name="name" type="string" length="100"/>
<property name="startDate" column="start_date"
type="date"/>
<property name="duration" type="integer"/>
<many-to-one name="location" column="location_id"
class="com.manning.hq.ch05.Location"/>
<set name="speakers" cascade="all">
<key column="event_id"/>
<one-to-many class="com.manning.hq.ch05.Speaker"/>
</set>
<set name="attendees" cascade="all">
<key column="event_id"/>
<one-to-many class="com.manning.hq.ch05.Attendee"/>
</set>
</class>
I load Event from session object. Now when i use getSpeaker(), hibernate would lazily load the speaker collection(assuming lazy is true by default).
I wanted to understand the following concept:
When I do event.getSpeaker(), which give me a set containing Speaker, is the Speaker object populdated with data, or the stubs are loaded initially and then when i make call to Speaker method the object is actually populdated