Loading a list from database using eclipselink jpa
database, eclipselink, jpa, rcp
Solution
1:M and ManyToMany relationships are lazy by default in JPA. That means you need to access the relationship for them to be fetched - call size() on the collection to view it in a debugging environment. You can also prefetch the collection in the initial query using 'fetch join' in the JPQL or an EclipseLink eclipselink.join-fetch query hint: http://wiki.eclipse.org/Using_EclipseLink_JPA_Extensions_(ELUG)#Join_Fetch
Problem
I have three tables in a derby database. Schedule, EmployeeSchedule, EmployeeScheduleInfo. Schedule has a list of EmployeeSchedule and EmployeeSchedule has a list of EmployeeScheduleInfo. I am using eclipselink jpa and i generated my entities and controllers from netbeans. My problem is when i load a Schedule object from database the list of EmployeeScheduleInfo objects in all EmployeeSchedule objects are not loaded, when i debug this i see ``` {IndirectList: not instantiated} ```