EclipseLink Solutions Guide for EclipseLink
Release 3.0
  Go To Table Of Contents
 Search
 PDF

Using Weaving

Weaving is a technique of manipulating the byte-code of compiled Java classes.

EclipseLink uses weaving to enhance Plain Old Java Object (POJO) classes and JPA entities with many features such lazy loading, change tracking, fetch groups, and internal optimizations.

How to Disable or Enable Weaving in a Java SE Environment

In a Java SE environment weaving is not enabled by default. This can affect LAZY One-To-One, Many-To-One and Basic relationships. It also has a major effect on performance and disable attribute change tracking.

To enable weaving in Java SE, the EclipseLink agent must be used when starting the Java VM.

java -javaagent:eclipselink.jar

Spring could also be used to allow JPA weaving in Java SE. See http://wiki.eclipse.org/EclipseLink/Examples/JPA/JPASpring for more information.

Static weaving can also be used, by including the following persistence property,

<property name="eclipselink.weaving" value="static"/>

See "weaving" in Jakarta Persistence API (JPA) Extensions Reference for EclipseLink for more information.

How to Disable or Enable Weaving in a Jakarta EE Environment

In a Jakarta EE environment weaving is enabled by default (on any Jakarta EE 5 or greater fully compliant application server, such as Weblogic, Webspehere, and Glassfish. JBoss does not allow weaving so you must use static weaving or Spring).

To disable weaving the weaving persistence unit property can be used,

<property name="eclipselink.weaving" value="false">
 

For more information on weaving see "weaving" in Jakarta Persistence API (JPA) Extensions Reference for EclipseLink.