EclipseLink/Examples/JPA/GlassFishV3 Web Tutorial
- 1 EclipseLink JPA Deployed on GlassFish 3 using Eclipse 3.5
- 1.1 Tutorial Source
- 1.2 Development Environment
- 1.3 Prerequisites
- 1.4 Downloading EclipseLink Libraries
- 1.5 References
EclipseLink JPA Deployed on GlassFish 3 using Eclipse 3.5
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.
And the DDL generation J2SE JPA application used to populate the database schema.
This example will also run fine with any Database that EclipseLink supports.
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.
- Do not use V3 TP2 - use the V3 Prelude release instead.
- The following issues were quickly solved within a 24h timeframe when posted to the GlassFish Forum
- 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 GlassFish V3 SNAPSHOT Server Plugin for Eclipse 3.4 jar problems with TP2 - use the Prelude Plugin
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
- Proceed to the following URL and download the latest eclipselink.zip which contains everything you need.
- Click on the "EclipseLink Installer Zip link which resolves to http://www.eclipse.org/downloads/download.php?file=/rt/eclipselink/releases/n.n.n/eclipselink-n.n.n.zip
- Expand the zip file and get the following 2 files
Download EclipseLink using Maven
See the repository on http://www.eclipse.org/eclipselink/downloads/index.php
Download EclipseLink using SVN - developers only
- Get the following eclipselink.jar and javax.persistence*.jar from http://www.eclipselink.org ready for your EclipseLink shared library
- The following page details four different ways to either obtain the binary jars or download the source and build them yourself with an anon account.