The <tt>project.xml</tt> file is the core of your application. It contains the descriptors and mappings you define and also includes any named queries or finders associated with your project.

The <tt>project.xml</tt> file is the core of your application. It contains the descriptors and mappings you define and also includes any named queries or finders associated with your project.

Line 38:

Line 41:

====XSD File Format====

====XSD File Format====

+

The <tt>project.xml</tt> file XSD is <tt>persistence_1_0.xsd</tt> and it is located in the ''<tt><ECLIPSELINK_HOME></tt>''<tt>\xsds</tt> directory.

−

The <tt>project.xml</tt> file XSD is <tt>eclispelink-object-persistence_1_0.xsd</tt> and it is located in the ''<tt><ECLIPSELINK_HOME></tt>''<tt>\xsds</tt> directory.

+

See [[EclipseLink/XSDs]] for more information.

====POJO Applications and Project Metadata====

====POJO Applications and Project Metadata====

−

For a POJO application, you define your project metadata in a <tt>project.xml</tt> file.

For a POJO application, you define your project metadata in a <tt>project.xml</tt> file.

The <tt>project.xml</tt> file provides a simple and flexible way to configure, modify, and troubleshoot the project metadata. Because of these attributes, the <tt>project.xml</tt> file is the preferred way to configure an EclipseLink project.Workbench provides a graphical tool to build and edit the <tt>project.xml</tt> file. For information on creating projects with Workbench, see [[#Creating the project.xml File with Workbench|Creating the project.xml File with Workbench]].

The <tt>project.xml</tt> file provides a simple and flexible way to configure, modify, and troubleshoot the project metadata. Because of these attributes, the <tt>project.xml</tt> file is the preferred way to configure an EclipseLink project.Workbench provides a graphical tool to build and edit the <tt>project.xml</tt> file. For information on creating projects with Workbench, see [[#Creating the project.xml File with Workbench|Creating the project.xml File with Workbench]].

−

====JPA Applications and Project Metadata====

====JPA Applications and Project Metadata====

−

For a JPA application, you can express project metadata using JPA annotations, <tt>persistence.xml</tt>, <tt>orm.xml</tt>, and EclipseLink JPA annotation and <tt>persistence.xml</tt> property extensions. The EclipseLink JPA persistence provider interprets all these sources of metadata to create an in-memory EclipseLink session and project at run time.

For a JPA application, you can express project metadata using JPA annotations, <tt>persistence.xml</tt>, <tt>orm.xml</tt>, and EclipseLink JPA annotation and <tt>persistence.xml</tt> property extensions. The EclipseLink JPA persistence provider interprets all these sources of metadata to create an in-memory EclipseLink session and project at run time.

Using EclipseLink JPA, you also have the option of specifying your metadata using EclipseLink <tt>sessions.xml</tt> and <tt>project.xml</tt> while accessing your persistent classes using JPA and an <tt>EntityManager</tt>. For more information, see [[Using%20EclipseLink%20JPA%20Extensions%20(ELUG)#What You May Need to Know About EclipseLink JPA Overriding Mechanisms|What You May Need to Know About EclipseLink JPA Overriding Mechanisms]].

Using EclipseLink JPA, you also have the option of specifying your metadata using EclipseLink <tt>sessions.xml</tt> and <tt>project.xml</tt> while accessing your persistent classes using JPA and an <tt>EntityManager</tt>. For more information, see [[Using%20EclipseLink%20JPA%20Extensions%20(ELUG)#What You May Need to Know About EclipseLink JPA Overriding Mechanisms|What You May Need to Know About EclipseLink JPA Overriding Mechanisms]].

−

====Creating the project.xml File with Workbench====

+

====Creating the project.xml File with Workbench====

Because you must synchronize the <tt>project.xml</tt> file with the classes and data source associated with your application, we recommend that you not modify this file manually. Workbench ensures proper synchronization, and is the best way to make changes to the project. Simply modify the project in Workbench and redeploy the <tt>project.xml</tt> file. Using this option reduces development time by eliminating the need to regenerate and recompile Java code each time the project changes.

Because you must synchronize the <tt>project.xml</tt> file with the classes and data source associated with your application, we recommend that you not modify this file manually. Workbench ensures proper synchronization, and is the best way to make changes to the project. Simply modify the project in Workbench and redeploy the <tt>project.xml</tt> file. Using this option reduces development time by eliminating the need to regenerate and recompile Java code each time the project changes.

Line 66:

Line 67:

'''Note'''<nowiki>:</nowiki> You can name this file with a name other than <tt>project.xml</tt><nowiki>; however, for clarity, this discussion assumes that the file has not been renamed.</nowiki>

'''Note'''<nowiki>:</nowiki> You can name this file with a name other than <tt>project.xml</tt><nowiki>; however, for clarity, this discussion assumes that the file has not been renamed.</nowiki>

|}

|}

−

====Creating project.xml Programatically====

====Creating project.xml Programatically====

−

Optionally, you can use the <tt>DeploymentXMLGenerator</tt> API to programatically generate the <tt>project.xml</tt> file in either of the following ways:

Optionally, you can use the <tt>DeploymentXMLGenerator</tt> API to programatically generate the <tt>project.xml</tt> file in either of the following ways:

* From an application, instantiate the <tt>DeploymentXMLGenerator</tt> and your java source. Call the following method:<tt>generate (</tt>''<tt><MW_Project.mwp></tt>''<tt>,</tt> ''<tt><output file.xml></tt>''<tt>)</tt>

* From an application, instantiate the <tt>DeploymentXMLGenerator</tt> and your java source. Call the following method:<tt>generate (</tt>''<tt><MW_Project.mwp></tt>''<tt>,</tt> ''<tt><output file.xml></tt>''<tt>)</tt>

Before you use either method, ensure that your classpath includes the ''<tt><ECLIPSELINK_HOME></tt>''<tt>\utils\workbench\config</tt> directory.

+

Before you use either method, ensure that your classpath includes the ''<tt><ECLIPSELINK_HOME></tt>''<tt>\jlib\eclipselink.jar</tt> and ''<tt><ECLIPSELINK_HOME></tt>''<tt>\utils\workbench\jlib\eclipselinkmw.jar</tt> files.

Line 83:

Line 82:

'''Note:''' If you are using EJB 3.0, you can use annotations to specify most of what you formerly specified in the <tt>project.xml</tt> file. To override annotations or specify options not supported by annotations, you can still provide a <tt>project.xml</tt> file in your EJB 3.0 application.

'''Note:''' If you are using EJB 3.0, you can use annotations to specify most of what you formerly specified in the <tt>project.xml</tt> file. To override annotations or specify options not supported by annotations, you can still provide a <tt>project.xml</tt> file in your EJB 3.0 application.

|}

|}

+

+

===sessions.xml File===

===sessions.xml File===

−

Each EclipseLink project belongs to an EclipseLink ''session''. A session is the facade through which an application accesses EclipseLink functionality (for more information on sessions, see [[EclipseLink/UserGuide/Using EclipseLink Sessions (ELUG)|EclipseLink Sessions]]).

Each EclipseLink project belongs to an EclipseLink ''session''. A session is the facade through which an application accesses EclipseLink functionality (for more information on sessions, see [[EclipseLink/UserGuide/Using EclipseLink Sessions (ELUG)|EclipseLink Sessions]]).

−

====XSD File Format====

====XSD File Format====

−

The <tt>sessions.xml</tt> file XSD is <tt>eclipse_persistence_sessions_1_0.xsd</tt> and it is located in the ''<tt><ECLIPSELINK_HOME></tt>''<tt>\xsds</tt> directory as well as on the web at http://www.eclipse.org/eclipselink/xsds/eclipse_persistence_sessions_1_0.xsd.

The <tt>sessions.xml</tt> file XSD is <tt>eclipse_persistence_sessions_1_0.xsd</tt> and it is located in the ''<tt><ECLIPSELINK_HOME></tt>''<tt>\xsds</tt> directory as well as on the web at http://www.eclipse.org/eclipselink/xsds/eclipse_persistence_sessions_1_0.xsd.

For a POJO application, you define your sessions in a <tt>sessions.xml</tt> file.

For a POJO application, you define your sessions in a <tt>sessions.xml</tt> file.

The <tt>sessions.xml</tt> file provides a simple and flexible way to configure, modify, and troubleshoot the application sessions. Because of these attributes, the <tt>sessions.xml</tt> file is the preferred way to configure an EclipseLink session.EclipseLink provides graphical toosl to build and edit the <tt>sessions.xml</tt> file. For information see [[Creating%20a%20Session%20(ELUG)|Creating a Session]].

The <tt>sessions.xml</tt> file provides a simple and flexible way to configure, modify, and troubleshoot the application sessions. Because of these attributes, the <tt>sessions.xml</tt> file is the preferred way to configure an EclipseLink session.EclipseLink provides graphical toosl to build and edit the <tt>sessions.xml</tt> file. For information see [[Creating%20a%20Session%20(ELUG)|Creating a Session]].

−

Line 117:

Line 114:

Using EclipseLink JPA, you also have the option of specifying your metadata using EclipseLink <tt>sessions.xml</tt> and <tt>project.xml</tt> while accessing your persistent classes using JPA and an <tt>EntityManager</tt>. For more information, see [[Using%20EclipseLink%20JPA%20Extensions%20(ELUG)#What You May Need to Know About EclipseLink JPA Overriding Mechanisms|What You May Need to Know About EclipseLink JPA Overriding Mechanisms]].

Using EclipseLink JPA, you also have the option of specifying your metadata using EclipseLink <tt>sessions.xml</tt> and <tt>project.xml</tt> while accessing your persistent classes using JPA and an <tt>EntityManager</tt>. For more information, see [[Using%20EclipseLink%20JPA%20Extensions%20(ELUG)#What You May Need to Know About EclipseLink JPA Overriding Mechanisms|What You May Need to Know About EclipseLink JPA Overriding Mechanisms]].

−

==Creating Deployment Files for Java Applications==

+

+

+

==Creating Deployment Files for Java Applications==

In a Java application, EclipseLink does not use a Java EE container for deployment. Instead, it relies on EclipseLink mechanisms to provide functionality and persistence. The key elements of this type of application are the lack of a Java EE container and the fact that you deploy the application by placing the application JAR file on the classpath.

In a Java application, EclipseLink does not use a Java EE container for deployment. Instead, it relies on EclipseLink mechanisms to provide functionality and persistence. The key elements of this type of application are the lack of a Java EE container and the fact that you deploy the application by placing the application JAR file on the classpath.

Session beans generally model a process, operation, or service and as such, are not persistent. You can build EclipseLink applications that wrap interaction with EclipseLink in session beans. Session beans execute all EclipseLink-related operations on behalf of the client.

Session beans generally model a process, operation, or service and as such, are not persistent. You can build EclipseLink applications that wrap interaction with EclipseLink in session beans. Session beans execute all EclipseLink-related operations on behalf of the client.

* [[Developing Applications Using EclipseLink JPA (ELUG)#Application Development with EclipseLink JPA|Application Development with EclipseLink JPA)]]

* [[Developing Applications Using EclipseLink JPA (ELUG)#Application Development with EclipseLink JPA|Application Development with EclipseLink JPA)]]

−

==Creating Deployment Files for JPA Applications==

+

+

+

==Creating Deployment Files for JPA Applications==

See [[Packaging and Deploying EclipseLink JPA Applications (ELUG)|Packaging and Deploying EclipseLink JPA Applications]] for information on how to create deployment files for your JPA application.

See [[Packaging and Deploying EclipseLink JPA Applications (ELUG)|Packaging and Deploying EclipseLink JPA Applications]] for information on how to create deployment files for your JPA application.

+

+

<!--

==Configuring the orion-ejb-jar.xml File for OC4J==

==Configuring the orion-ejb-jar.xml File for OC4J==

Line 373:

Line 375:

|}

|}

−

==Configuring the weblogic-ejb-jar.xml File for WebLogic Server==

+

-->

−

Before you deploy a EclipseLink application to a WebLogic Server, you must modify the <tt>weblogic-ejb-jar.xml</tt> file.

+

+

+

==Configuring the weblogic-ejb-jar.xml File for WebLogic Server==

+

Before you deploy a EclipseLink application to Oracle WebLogic Server, you must modify the <tt>weblogic-ejb-jar.xml</tt> file.

Avoid the <tt>weblogic-ejb-jar.xml</tt> tags that EclipseLink either does not support or does not require (see [[#What You May Need to Know About Unsupported weblogic-ejb-jar.xml File Tags|What You May Need to Know About Unsupported weblogic-ejb-jar.xml File Tags]]).

Avoid the <tt>weblogic-ejb-jar.xml</tt> tags that EclipseLink either does not support or does not require (see [[#What You May Need to Know About Unsupported weblogic-ejb-jar.xml File Tags|What You May Need to Know About Unsupported weblogic-ejb-jar.xml File Tags]]).

Line 382:

Line 387:

===What You May Need to Know About Unsupported weblogic-ejb-jar.xml File Tags===

===What You May Need to Know About Unsupported weblogic-ejb-jar.xml File Tags===

−

The <tt>weblogic-ejb-jar.xml</tt> file includes the following tags that EclipseLink either does not support or does not require:

The <tt>weblogic-ejb-jar.xml</tt> file includes the following tags that EclipseLink either does not support or does not require:

−

* <tt>concurrency-strategy</tt><nowiki>: This tag specifies how WebLogic manages concurrent users for a given bean. Because EclipseLink manages concurrent access internally, it does not require this tag.</nowiki><br>For more information about the EclipseLink concurrency strategy, see [[Configuring%20a%20Descriptor%20(ELUG)#Configuring Locking Policy|Configuring Locking Policy]].

+

* <tt>concurrency-strategy</tt><nowiki>: This tag specifies how Oracle WebLogic Server manages concurrent users for a given bean. Because EclipseLink manages concurrent access internally, it does not require this tag.</nowiki><br>For more information about the EclipseLink concurrency strategy, see [[Configuring%20a%20Descriptor%20(ELUG)#Configuring Locking Policy|Configuring Locking Policy]].

* <tt>db-is-shared</tt><nowiki>: Because EclipseLink does not make any assumptions about the exclusivity of database access, EclipseLink does not require this tag. EclipseLink addresses multiuser access issues through various locking and refreshing policies.</nowiki>

* <tt>db-is-shared</tt><nowiki>: Because EclipseLink does not make any assumptions about the exclusivity of database access, EclipseLink does not require this tag. EclipseLink addresses multiuser access issues through various locking and refreshing policies.</nowiki>

* <tt>delay-updates-until-end-of-tx</tt><nowiki>: EclipseLink always delays updates until the end of a transaction, and does not require this tag.</nowiki>

* <tt>delay-updates-until-end-of-tx</tt><nowiki>: EclipseLink always delays updates until the end of a transaction, and does not require this tag.</nowiki>

Create Java source files, which you compile and deploy outside of Workbench.

We recommend XML deployment because XML files are easier to deploy and troubleshoot than compiled Java files. This approach gives you a very flexible configuration that enables you to make changes safely and easily. XML deployment files do not require third-party applications or compilers to deploy successfully.

Note: If you are using JPA, you can use annotations to specify most of what you formerly specified in deployment descriptors. Use deployment descriptors to override annotations or specify options not supported by annotations.

project.xml File

The project.xml file is the core of your application. It contains the descriptors and mappings you define and also includes any named queries or finders associated with your project.

XSD File Format

The project.xml file XSD is persistence_1_0.xsd and it is located in the <ECLIPSELINK_HOME>\xsds directory.

POJO Applications and Project Metadata

For a POJO application, you define your project metadata in a project.xml file.

The project.xml file provides a simple and flexible way to configure, modify, and troubleshoot the project metadata. Because of these attributes, the project.xml file is the preferred way to configure an EclipseLink project.Workbench provides a graphical tool to build and edit the project.xml file. For information on creating projects with Workbench, see Creating the project.xml File with Workbench.

JPA Applications and Project Metadata

For a JPA application, you can express project metadata using JPA annotations, persistence.xml, orm.xml, and EclipseLink JPA annotation and persistence.xml property extensions. The EclipseLink JPA persistence provider interprets all these sources of metadata to create an in-memory EclipseLink session and project at run time.

Creating the project.xml File with Workbench

Because you must synchronize the project.xml file with the classes and data source associated with your application, we recommend that you not modify this file manually. Workbench ensures proper synchronization, and is the best way to make changes to the project. Simply modify the project in Workbench and redeploy the project.xml file. Using this option reduces development time by eliminating the need to regenerate and recompile Java code each time the project changes.

Before you use either method, ensure that your classpath includes the <ECLIPSELINK_HOME>\jlib\eclipselink.jar and <ECLIPSELINK_HOME>\utils\workbench\jlib\eclipselinkmw.jar files.

Note: If you are using EJB 3.0, you can use annotations to specify most of what you formerly specified in the project.xml file. To override annotations or specify options not supported by annotations, you can still provide a project.xml file in your EJB 3.0 application.

sessions.xml File

Each EclipseLink project belongs to an EclipseLink session. A session is the facade through which an application accesses EclipseLink functionality (for more information on sessions, see EclipseLink Sessions).

When you use the XSD formatted sessions.xml file, the EclipseLink run time separates sessions.xml file validation from session instantiation. Separating XML file formatting problems from Session Manager session instantiation problems simplifies troubleshooting. Exceptions thrown during validation clearly indicate that the failure is due to an invalid sessions.xml file, as the following illustrates.

Enhanced Validation Exceptions

Exception [ECLIPSELINK-9010] (EclipseLink): org.eclipselink.exceptions.SessionLoaderException
Exception Description: A End tag does not match start tag 'session'. was thrown while parsing the XML file against the XML schema.
Internal Exception: oracle.xml.parser.v2.XMLParseException: End tag does not match start tag 'session'.

POJO Applications and Session Metadata

For a POJO application, you define your sessions in a sessions.xml file.

The sessions.xml file provides a simple and flexible way to configure, modify, and troubleshoot the application sessions. Because of these attributes, the sessions.xml file is the preferred way to configure an EclipseLink session.EclipseLink provides graphical toosl to build and edit the sessions.xml file. For information see Creating a Session.

JPA Applications and Session Metadata

For a JPA application, you can express session metadata using JPA annotations, persistence.xml, orm.xml, and EclipseLink JPA annotation and persistence.xml property extensions. The EclipseLink JPA persistence provider interprets all these sources of metadata to create an in-memory EclipseLink session and project at run time.

Creating Deployment Files for Java Applications

In a Java application, EclipseLink does not use a Java EE container for deployment. Instead, it relies on EclipseLink mechanisms to provide functionality and persistence. The key elements of this type of application are the lack of a Java EE container and the fact that you deploy the application by placing the application JAR file on the classpath.

Creating Deployment Files for Session Bean Applications

Session beans generally model a process, operation, or service and as such, are not persistent. You can build EclipseLink applications that wrap interaction with EclipseLink in session beans. Session beans execute all EclipseLink-related operations on behalf of the client.

This type of design uses JTS and externally managed transactions, but does not incur the overhead associated with persistence applications. Session bean applications also scale and deploy easily.

What You May Need to Know About Unsupported weblogic-ejb-jar.xml File Tags

The weblogic-ejb-jar.xml file includes the following tags that EclipseLink either does not support or does not require:

concurrency-strategy: This tag specifies how Oracle WebLogic Server manages concurrent users for a given bean. Because EclipseLink manages concurrent access internally, it does not require this tag.For more information about the EclipseLink concurrency strategy, see Configuring Locking Policy.

db-is-shared: Because EclipseLink does not make any assumptions about the exclusivity of database access, EclipseLink does not require this tag. EclipseLink addresses multiuser access issues through various locking and refreshing policies.

delay-updates-until-end-of-tx: EclipseLink always delays updates until the end of a transaction, and does not require this tag.

finders-load-bean: EclipseLink always loads the bean upon execution of the finder, and does not require this tag.

pool: EclipseLink does not use a pooling strategy for entity beans. This avoids object-identity problems that can occur due to pooling.

lifecycle: This element manages beans that follow a pooling strategy. Because EclipseLink does not use a pooling strategy, EclipseLink ignores this tag.

is-modified-method-name: EclipseLink does not require a bean developer-defined method to detect changes in the object state.

isolation-level: Because isolation level settings for the cache or database transactions are specified in the EclipseLink project, EclipseLink ignores this tag.

cache: Because you define EclipseLink cache properties in Workbench, this tag is unnecessary.