I receive the following warning on the GlassFish terminal while deploying an application that has lazy fetching in entities,
WARNING: Reverting the lazy setting on the
OneToOne
orManyToOne
attribute[zoneTable]
for the entity class[class entity.ZoneCharge]
since weaving was not enabled or did not occur.
for whatever entities are listed in the project.
My persistence.xml
file looks something like the following.
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.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_2_0.xsd">
<persistence-unit name="Project-ejbPU" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>jdbc/pool</jta-data-source>
<class>entity.ZoneTable</class>
<!--Other classes-->
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.weaving" value="static"/>
<property name="eclipselink.target-server" value="SunAS9"/>
<property name="eclipselink.logging.parameters" value="true"/>
<property name="eclipselink.logging.level.sql" value="FINEST"/>
<property name="eclipselink.logging.level" value="FINEST" />
<property name="eclipselink.logging.level" value="WARNING"/>
<property name="eclipselink.logging.level.cache" value="FINEST"/>
</properties>
</persistence-unit>
</persistence>
The ZoneTable
class looks like,
@Entity
@Table(name = "zone_table", catalog = "projectdb", schema = "")
public class ZoneTable implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "zone_id")
private Long zoneId;
@Column(name = "zone_name")
private String zoneName;
@OneToMany(mappedBy = "zoneTable", fetch = FetchType.LAZY)
private Set<ZoneCharge> zoneChargeSet;
//Setters and getters.
}
Here lazy fetching works even with remote EJBs but I think, it is considered eager because of the above warning.
How to enable weaving (or some other way) to avoid this warning?
When I enter this command as mentioned here,
java org.eclipse.persistence.tools.weaving.jpa.StaticWeave
on the command line, I get the following error.
Error: could not find or load main classorg.eclipse.persistence.tools.weaving.jpa.StaticWeave
What are the ways to overcome this warning?