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/Examples/JPA/GlassFishV2 Web Tutorial"

m (EclipseLink JPA Deployed on GlassFish 2.1 using Eclipse WTP)
m (Install GlassFish Eclipse 3.4 Server Plugin=)
Line 28: Line 28:
 
* C:\opt\glassfish>ant -f setup.xml
 
* C:\opt\glassfish>ant -f setup.xml
  
===Install GlassFish Eclipse 3.4 Server Plugin====
+
====Install GlassFish Eclipse 3.4 Server Plugin====
 
The GlassFish server plugin is not shipped by default with Eclipse - you will need to update your Eclipse IDE to pick up the plugin.
 
The GlassFish server plugin is not shipped by default with Eclipse - you will need to update your Eclipse IDE to pick up the plugin.
  

Revision as of 11:40, 15 September 2008

EclipseLink JPA Deployed on GlassFish 2.1 using Eclipse WTP

Note: This tutorial' is under construction for the next week as of 20080915.


If you want to get a small web application running quickly on GlassFish - the services provided by the Web Tools Project pluggin in the Eclipse IDE can take care of the deployment details and set the server into debug mode for you.

This basic example details how to use Eclipse to run/debug a minimum J2EE web application servlet using EclipseLink JPA as the persistence provider. The goal of this example is to detail the minimum steps needed to run EclipseLink inside GlassFish using the Eclipse IDE - at this point no presentation/controller layer such as JSF, Spring or Struts will be used beyond a basic HttpServlet so we can concentrate on the the integration layer JPA setup.

The DALI project was used to generate Entities from a schema with sequences already populated.

Development Environment

Software: Eclipse IDE for Java EE 3.4 Ganymede (June 2008 +) with all 5 packages (DTP 1.6, EMF 2.4, GEF 3.4, WTP 3.0, XSD 2.4), Oracle 11g DB 11.1.0.6.0, Java JDK 1.6.0_04, GlassFish V2.1 build 50

This example will run fine with any Database that EclipseLink supports.

Prerequisites

Install Eclipse EE

  • I installed a clean version of Eclipse Ganymede (June 2008) with all of WTP 3.0

Install a Database

  • In this example I am using Oracle 11g, the table schemas have already been created manually and all entity java classes have been generated using the Eclipse DALI tool.

Install GlassFish

I installed the latest GlassFish V2.1 build and followed the instructions on that page.

  • C:\opt>java -Xmx256m -jar glassfish-installer-v2.1-b50-_20080915_windows.jar
  • C:\opt\glassfish>cd glassfish
  • C:\opt\glassfish>ant -f setup.xml

Install GlassFish Eclipse 3.4 Server Plugin

The GlassFish server plugin is not shipped by default with Eclipse - you will need to update your Eclipse IDE to pick up the plugin.

  • Goto the Servers tab in a Java EE view and right-click New | Server
  • Select the link "Download additional Server adapters"
  • Select the GlassFish Java EE 5 Server from java.net - make sure it is version 1.0.9+

Glassfish download additional servers.JPG

  • Use the V2 plugin when creating a server

All of deployment, JNDI setup, persistence.xml configuration, jpql query example - in progress ......

Back to the top