Jump to: navigation, search

EclipseLink/Examples/MySports/GlassFish

< EclipseLink‎ | Examples‎ | MySports
Revision as of 09:51, 30 April 2012 by Douglas.clarke.oracle.com (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Upgrade and Configure GlassFish

Use this procedure to upgrade GlassFish to use a more recent EclipseLink version and prepare the connection pool.

  1. Replace the following JAR files from <GLASSFISH_HOME>\glassfish\modules\ with the JAR files from the EclipseLink OSGI bundle:
    • org.eclipse.persistence.antlr.jar
    • org.eclipse.persistence.asm.jar
    • org.eclipse.persistence.core.jar
    • org.eclipse.persistence.jpa.jar
    • org.eclipse.persistence.jpa.modelgen.jar
    • org.eclipse.persistence.oracle.jar
  2. Copy the following JAR file from the EclipseLink OSGI bundle to <GLASSFISH_HOME>\glassfish\modules\:
    • org.eclipse.persistence.moxy_2.3.0.v20110604-r9504.jar
  3. Use the GlassFish Admin Console to create a new JDBC resource named jdbc/MySports and a new JDBC connection pool named MySportsPool. In this example, we will use the embedded Derby database:
    • Resource type: javax.sql.DataSource
    • Datasource classname: org.apache.derby.jdbc.EmbeddedDataSource40
      Note: Be sure to edit the JDBC Connection Pool properties to reflect your database connection information. In this example, we will use:
    • User: APP
    • Password: APP
    • ServerName: localhost
    • DatabaseName: gemini
    • PortNumber: 1527

Mysports jdbc.png

Configure Eclipse Environment

Now you can configure Eclipse to run the MySports example.

  1. Add a variable named eclipselink_2.3_jar with the value <ECLIPSELINK OSGI BUNDLE>\org.eclipse.persistence.core_2.3.0.<BUILD>.jar.
    This is used for the javaagent of the test project. You can add this variable by creating a String Substitution variable, as shown here:
    Mysports variable.png
  2. Obtain the three example projects from the EclipseLink SVN repository:
    Note: If you use the Eclipse Team Provider for SVN plugin (http://www.eclipse.org/subversive/downloads.php) Eclipse will can import the example projects.
  3. Start the Derby server. The GlassFish installation includes a Derby instance that can be used, in the <GLASSFISH_HOME>\javadb\ folder.
  4. Import the EclipseLink MySports projects into Eclipse.
  5. Create a new Derby connection profile. Use the same JDBC Connection Properties that you used when creating the GlassFish connection pool.
  6. Add the Connectivity Driver Definition for the Derby database to the project.
    Mysports derbyclientjar.png
  7. Edit the eclipselink-examples-mysports.properties file to match your database connection information.
    Mysports properties.png