Difference between revisions of "EclipseLink/UserGuide/JPA/Advanced JPA Development/Performance/Weaving/Weaving POJO Classes"

From Eclipsepedia

Jump to: navigation, search
m
m (page obsolete)
 
(2 intermediate revisions by one user not shown)
Line 1: Line 1:
 +
----
 +
 +
 +
'''[[Image:Elug_draft_icon.png|Warning]] This page is now obsolete. '''
 +
 +
For current information, please see "About Weaving" in the ''Understanding EclipseLink (Concepts Guide)'':
 +
http://www.eclipse.org/eclipselink/documentation/latest/concepts/app_dev007.htm
 +
 +
 +
----
 +
 +
 
{{EclipseLink_UserGuide
 
{{EclipseLink_UserGuide
 
|info=y
 
|info=y
Line 59: Line 71:
 
</li>
 
</li>
 
<li> Weave the JAR.<br>For more information, see the following:
 
<li> Weave the JAR.<br>For more information, see the following:
* [[#Configuring_Dynamic_Weaving_Using_the_EclipseLink_Agent|Configuring Dynamic Weaving Using the EclipseLink Agent]]
+
* [[EclipseLink/UserGuide/JPA/Advanced_JPA_Development/Performance/Weaving/Dynamic_Weaving|Configuring Dynamic Weaving]]
* [[#Configuring_Static_Weaving|Configuring Static Weaving]]
+
* [[EclipseLink/UserGuide/JPA/Advanced_JPA_Development/Performance/Weaving/Static_Weaving|Configuring Static Weaving]]
 
</li></ol>
 
</li></ol>
 
 
  
  

Latest revision as of 14:27, 23 April 2013



Warning This page is now obsolete.

For current information, please see "About Weaving" in the Understanding EclipseLink (Concepts Guide): http://www.eclipse.org/eclipselink/documentation/latest/concepts/app_dev007.htm




EclipseLink JPA

link="http://wiki.eclipse.org/EclipseLink"
EclipseLink
Website
Download
Community
Mailing ListForumsIRC
Bugzilla
Open
Help Wanted
Bug Day
Contribute
Browse Source

[edit] Weaving POJO Classes

EclipseLink uses weaving to enable the following for POJO classes:

  • Lazy loading
  • Change tracking
  • Fetch groups

EclipseLink weaves all the POJO classes in the JAR you create when you package a POJO application for weaving, as described in Packaging a POJO Application for Weaving, below.

EclipseLink weaves all the classes defined in the persistence.xml file, that is:

  • all the classes you list in the persistence.xml file;
  • all classes relative to the JAR containing the persistence.xml file if element <exclude-unlisted-classes> is false.

[edit] Packaging a POJO Application for Weaving

To package a POJO application for weaving, you create a JAR that contains a sessions.xml file and a persistence.xml file, as described below:

  1. Create a sessions.xml file for your application.
    For more information, see Introduction to EclipseLink Sessions.
  2. Create a persistence.xml file for your application and reference your sessions.xml file, as the following example shows.
    persistence.xml File for an EclipseLink JPA Application
    <persistence>
        <persistence-unit name="appname">
            <exclude-unlisted-classes>false</exclude-unlisted-classes>
            <properties>
    
                <property
                    name="eclipselink.session-name"
                    value="appname-session"
                >
                <property
                    name="eclipselink.sessions-xml"
                    value="sessions.xml"
                >
            </properties>
        </persistence-unit>
    </persistence>
    
  3. Create a JAR file that contains your POJO classes, sessions.xml file, and persistence.xml file, as the following example shows.
    Put both the persistence.xml and sessions.xml file in a META-INF directory.
    JAR File for a POJO Application
    appname.jar
        META-INF
            persistence.xml
            sessions.xml
        *.java
    
  4. Weave the JAR.
    For more information, see the following:


Eclipselink-logo.gif
Version: 2.2.0 DRAFT
Other versions...