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}
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With