Hi all, thanks in advance for your help.
I have checked the documentation from EclipseLink to configure the persistent unit in a static way so that I can load associated objects in a lazy way. However I am not being able to get through. This is the content of my persistence.xml file
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="JPAIncidencias" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>java:/comp/env/jdbc/SistemaIncidencias</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.session.customizer" value="utils.JPAEclipseLinkSessionCustomizer"/>
<property name="eclipselink.logging.level" value="FINEST"/>
<property name="eclipselink.weaving" value="static"/>
<property name="eclipselink.weaving.lazy" value="true"/>
<property name="eclipselink.weaving.changetracking" value="true"/>
<property name="eclipselink.weaving.fetchgroups" value="true"/>
<property name="eclipselink.weaving.internal" value="true"/>
<property name="eclipselink.weaving.eager" value="false"/>
</properties>
</persistence-unit>
</persistence>
I am setting the entities in the following way:
Class A -> B (OneToMany)
public class A{
private ArrayList toB;
//getter and setter
}
public class B{
private A toA;
//getter and setter
}
and in the orm.xml got the following
<entity class="package.A">
<table name="aa">
</table>
<one-to-many fetch="LAZY" name="toB" target-entity="package.B" mapped-by="toA">
</one-to-many>
</entity>
<entity class="package.B">
<table name="bb">
</table>
<many-to-one name="toA">
<join-column name="A_ID" referenced-column-name="ID"/>
</many-to-one>
</entity>
from B to A is eager by default, and from A to B lazy by default.
If possible would like to keep using ArrayList, but any [EclipseLink]List class arranged for maintaining indirection that works in not a very problematic way (regarding maintainance) will do fine. I used static weaving 'cause from the documentation I knew that it should only be defined once in the persistence.xml file.
Any hints on what I am doing wrong?
Thank you very much in advance.
Carlos