Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "EclipseLink/Development/Dynamic/Design NativeXML"

(New page: == Dynamic Persistence Design: Native XML Configuration == The dynamic persistence support includes the use of XML to define the mappings and in effect the dynamic entity class structure....)
 
(= Project XML Usage)
Line 13: Line 13:
 
<source lang="java">
 
<source lang="java">
 
DatabaseLogin login = AllTests.getTestLogin();
 
DatabaseLogin login = AllTests.getTestLogin();
p = EntityTypeBuilder.loadDynamicProject("org/eclipse/persistence/testing/tests/dynamic/orm/projectxml/Employee_utf8.xml", login);
+
Project project = EntityTypeBuilder.loadDynamicProject("org/eclipse/persistence/testing/tests/dynamic/orm/projectxml/Employee_utf8.xml", login);
  
ds = p.createDatabaseSession();
+
DatabaseSession session = project.createDatabaseSession();
ds.setLogLevel(SessionLog.FINE);
+
session.setLogLevel(SessionLog.FINE);
ds.login();
+
session.login();
 
</source>
 
</source>

Revision as of 14:19, 10 September 2009

Dynamic Persistence Design: Native XML Configuration

The dynamic persistence support includes the use of XML to define the mappings and in effect the dynamic entity class structure. This support includes:

  1. Project deployment XML with Native ORM API
  2. Sessions.xml with Project deployment XML with Native ORM API
  3. Sessions.xml with Project deployment XML with EclipseLink JPA (using PU properties)

= Project XML Usage

The EntityTypeBuilder provides a static helper that allows a resource string describing the location of the project's deployment XMl file and a DatabaseLogin specifying the database connection/pool information.

DatabaseLogin login = AllTests.getTestLogin();
Project project = EntityTypeBuilder.loadDynamicProject("org/eclipse/persistence/testing/tests/dynamic/orm/projectxml/Employee_utf8.xml", login);
 
DatabaseSession session = project.createDatabaseSession();
session.setLogLevel(SessionLog.FINE);
session.login();

Back to the top