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/GlassFishV3 Web Tutorial"

m (EclipseLink JPA Deployed on GlassFish 3 using Eclipse WTP)
m (EclipseLink JPA Deployed on GlassFish 3 using Eclipse WTP)
Line 1: Line 1:
=EclipseLink JPA Deployed on GlassFish 3 using Eclipse WTP=
+
=EclipseLink JPA Deployed on GlassFish 3 using Eclipse 3.5=
  
 
''[[EclipseLink/Examples/JPA/GlassFishV2_Web_Tutorial|Please refer to the GlassFish V2 page for generic EclipseLink on GlassFish Issues.]]
 
''[[EclipseLink/Examples/JPA/GlassFishV2_Web_Tutorial|Please refer to the GlassFish V2 page for generic EclipseLink on GlassFish Issues.]]
  
If you want to get a small web application running quickly on GlassFish - the services provided by the '''Web Tools Project''' plugin in the '''Eclipse IDE''' can take care of the deployment details and set the server into debug mode for you.
+
If you want to get a small web application running quickly on the GlassFish V3 application server using the Eclipse IDE, follow the instructions in this tutorial.
  
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.
+
This basic example details how to use Eclipse to run/debug a minimum J2EE 5/6 web application servlet using [http://www.eclipselink.org EclipseLink JPA] as the persistence provider.  The goal of this example is to detail the minimum steps needed to run EclipseLink inside GlassFish V3 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 [http://wiki.eclipse.org/Dali DALI] project was used to generate Entities from a schema with sequences already populated.
 
The [http://wiki.eclipse.org/Dali DALI] project was used to generate Entities from a schema with sequences already populated.
 +
 +
==Tutorial Source==
 +
<!--The EAR, EJB and WEB Eclipse project source for this EclipseLink WebLogic tutorial is available online at the following locations.  These 3 projects must be imported along with the jpa core eclipselink project.
 +
 +
*Checkout the following 3 projects together from $trunk/examples.
 +
**''org.eclipse.persistence.example.jpa.server.glassfish.enterpriseEAR''
 +
**''org.eclipse.persistence.example.jpa.server.glassfish.enterpriseEJB''
 +
**''org.eclipse.persistence.example.jpa.server.glassfish.enterpriseWeb''
 +
 +
* EclipseLink source via SVN committer access
 +
svn+ssh://user@eclipse/svnroot/rt/org.eclipse.persistence/trunk
 +
 +
* EclipseLink source via SVN anonymous access
 +
svn://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk
 +
 +
The following link will put you at the root of the SVN tree using the online version of subclipse.
 +
 +
http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/examples/org.eclipse.persistence.example.jpa.server.glassfish.enterpriseEAR
 +
 +
http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/examples/org.eclipse.persistence.example.jpa.server.glassfish.enterpriseEJB
 +
 +
http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/examples/org.eclipse.persistence.example.jpa.server.glassfish.enterpriseWeb
 +
-->
 +
And the DDL generation J2SE JPA application used to populate the database schema.
 +
 +
http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/examples/org.eclipse.persistence.example.jpa.server.common.ddlgen
  
 
==Development Environment==
 
==Development Environment==
'''Software:''' [http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/ganymede/R/eclipse-jee-ganymede-win32.zip 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, [http://download.java.net/glassfish/v3/promoted GlassFish V3 Prelude]
+
'''Software:''' [http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/galileo/R/eclipse-jee-galileo-win32.zip Eclipse IDE for Java EE 3.5 Galileo] (June 2009 +) , JavaDB (part of GlassFish), SUN Java JDK 1.6.0_xx, [https://glassfish.dev.java.net/public/downloadsindex.html GlassFish V3 Prelude]
  
This example will run fine with any Database that EclipseLink supports.
+
This example will also run fine with any Database that EclipseLink supports.
  
 
==Prerequisites==
 
==Prerequisites==
 
===<font color="green">Install Eclipse EE</font>===
 
===<font color="green">Install Eclipse EE</font>===
*I installed a clean version of Eclipse Ganymede (June 2008) with all of WTP 3.0
+
*I installed a clean version of Eclipse 3.5 Galileo (June 2009)
  
 
===<font color="green">Install a Database</font>===
 
===<font color="green">Install a Database</font>===
*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 [http://wiki.eclipse.org/Dali DALI] tool.
+
*In this example I am the included JavaDB that is part of GlassFish V3, the table schemas have already been created manually and all entity java classes have been generated using the Eclipse [http://wiki.eclipse.org/Dali DALI] tool.
  
 
===<font color="green">Install GlassFish</font>===
 
===<font color="green">Install GlassFish</font>===
*Do not use V3 TP2 - use the [http://download.java.net/glassfish/v3/promoted/ V3 Prelude release] instead.
+
*Do not use V3 TP2 - use the [https://glassfish.dev.java.net/public/downloadsindex.html V3 Prelude release] instead.
 
*The following issues were quickly solved within a 24h timeframe when posted to the [http://forums.java.net/jive/forum.jspa?forumID=56&start=0 GlassFish Forum]
 
*The following issues were quickly solved within a 24h timeframe when posted to the [http://forums.java.net/jive/forum.jspa?forumID=56&start=0 GlassFish Forum]
 
+
**[http://forums.java.net/jive/thread.jspa?threadID=46886&tstart=0 http://forums.java.net/jive/thread.jspa?threadID=46886&tstart=0 GF3tp2 domain1 fails to start out of the box - JDK 1.7 collision and no proxy set]
[http://forums.java.net/jive/thread.jspa?threadID=46886&tstart=0 http://forums.java.net/jive/thread.jspa?threadID=46886&tstart=0 GF3tp2 domain1 fails to start out of the box - JDK 1.7 collision and no proxy set]
+
**[http://forums.java.net/jive/thread.jspa?threadID=46901&tstart=0 http://forums.java.net/jive/thread.jspa?threadID=46886&tstart=0 GlassFish V3 SNAPSHOT Server Plugin for Eclipse 3.4 jar problems with TP2 - use the Prelude Plugin]
 
+
===<font color="green">Install Eclipse GlassFish Server Plugin</font>===
[http://forums.java.net/jive/thread.jspa?threadID=46901&tstart=0 http://forums.java.net/jive/thread.jspa?threadID=46886&tstart=0 GlassFish V3 SNAPSHOT Server Plugin for Eclipse 3.4 jar problems with TP2 - use the Prelude Plugin]
+
*Currently the '''"Download additional server adapters"''' link on the ''"New Server"'' dialog will not work with Eclipse 3.5 - '''Use the "Help | Install New Software" menu instead ''' via the https://ajax.dev.java.net/eclipse/site.xml update site to get version 32+ of the plugin that is compatible with Galileo.
 
+
**You may refer to the details of Eclipse Bug # [http://bugs.eclipse.org/280365 280365].
*It is recommended that you install the GlassFish V3 Prelude version and use the latest 1.0.9+ V3 SNAPSHOT Eclipse 3.4 Server plugin to run/debug the prelude server.   
+
<!--*It is recommended that you install the GlassFish V3 Prelude version and use the latest 1.0.9+ V3 SNAPSHOT Eclipse 3.4 Server plugin to run/debug the prelude server.   
 
*Using the GlassFish V3 Prelude install - we select the SNAPSHOT version of the plugin after using "Download Additional Server Adapters" to get a 1.0.9 GlassFish plugin or later.
 
*Using the GlassFish V3 Prelude install - we select the SNAPSHOT version of the plugin after using "Download Additional Server Adapters" to get a 1.0.9 GlassFish plugin or later.
  
 
[[Image:Glassfish_prelude_new_server_use_snapshot.JPG]]
 
[[Image:Glassfish_prelude_new_server_use_snapshot.JPG]]
  
 +
-->
  
All of deployment, JNDI setup, persistence.xml configuration, jpql query example - in progress when we start JEE6 examples as V3 Prelude (a JEE6) server does not support deploying JEE5 EAR projects......
+
20090909 All of deployment, JNDI setup, persistence.xml configuration, jpql query example - in progress ......
  
 
==Downloading EclipseLink Libraries==
 
==Downloading EclipseLink Libraries==

Revision as of 12:18, 9 September 2009

EclipseLink JPA Deployed on GlassFish 3 using Eclipse 3.5

Please refer to the GlassFish V2 page for generic EclipseLink on GlassFish Issues.

If you want to get a small web application running quickly on the GlassFish V3 application server using the Eclipse IDE, follow the instructions in this tutorial.

This basic example details how to use Eclipse to run/debug a minimum J2EE 5/6 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 V3 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.

Tutorial Source

And the DDL generation J2SE JPA application used to populate the database schema.

http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/examples/org.eclipse.persistence.example.jpa.server.common.ddlgen

Development Environment

Software: Eclipse IDE for Java EE 3.5 Galileo (June 2009 +) , JavaDB (part of GlassFish), SUN Java JDK 1.6.0_xx, GlassFish V3 Prelude

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

Prerequisites

Install Eclipse EE

  • I installed a clean version of Eclipse 3.5 Galileo (June 2009)

Install a Database

  • In this example I am the included JavaDB that is part of GlassFish V3, the table schemas have already been created manually and all entity java classes have been generated using the Eclipse DALI tool.

Install GlassFish

Install Eclipse GlassFish Server Plugin

  • Currently the "Download additional server adapters" link on the "New Server" dialog will not work with Eclipse 3.5 - Use the "Help | Install New Software" menu instead via the https://ajax.dev.java.net/eclipse/site.xml update site to get version 32+ of the plugin that is compatible with Galileo.
    • You may refer to the details of Eclipse Bug # 280365.

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

Downloading EclipseLink Libraries

Download EclipseLink using HTTP - recommended

Download EclipseLink using Maven

See the repository on http://www.eclipse.org/eclipselink/downloads/index.php

Download EclipseLink using SVN - developers only

References

EclipseLink JPA on GlassFish Server V2

Back to the top