EclipseLink JPA Development using NetBeans 6.9.1
- This page details how to develop applications using EclipseLink JPA in an environment that uses NetBeans as the IDE and GlassFish as the Java Enterprise application server.
- As of Feb 2011 NetBeans is released as version 6.9.1 which includes support for EclipseLink 2.0.1 as a JPA 2.0 provider on GlassFish 3.0.1 (Hibernate 3.2.5 as a JPA 1.0 provider is also supported).
- I have been able to run the beta version of Netbeans 7.0 that includes the GlassFish 3.1 server along with EclipseLink 2.2 and full JEE6 support (including JAX-RS 1.1, EJB 3.1 and JSF 2.0) with nothing but small minor issues.
- For this tutorial we can use either 6.9.1 or 7.0beta.
- The key point about Netbeans is the tight integration with GlassFish server. This is evident by the ease at which the wizards for JPA, JSF and WebServices allow us to write almost no template or configuration code - the Netbeans IDE takes care of this.
Differences between Netbeans 6.8/6.9 and 7.0
- EclipseLink 2.0.1
- Hibernate 3.2.5
- Spring MVC 2.5
- STruts 1.3.8
- EclipseLink 2.2
- Hibernate 3.2.5
- JSF 2.0
- primefaces is the JSF component suite (new to NB7 none is default)
- additional "enable contexts and DI" for web projects
- Spring MVC 3.0.2
- Struts 1.3.8
- There are two persistence libraries shipped with GlassFish V3 as part of NetBeans. The first thing we should do is upgrade the 6 bundles to the latest versions (and make sure to clear the felix OSGI cache - as in erase it from the filesystem)
- Update the single jar and the JPA 2.0 specification jar in Netbeans here
- You will likely want to regenerate the source as well, execute the following ant script off your 2.2 trunk view.
- When you upgrade the eclipselink-2.0.2.jar you have 2 options
- 1) copy over the old jar and keep the 2.0.2 name (will avoid any classpath issues in existing Netbeans projects.
- 2) keep/remove the old 2.0.2 jar, copy the new 2.2 jar and update the classpath of all Netbeans projects.
- If you do 2) you will need to fix all the EclipseLink 2.0 project references below
- Update the 6 OSGI bundles and the JPA 2.0 specification jar in GlassFish 3 here
T1: Large EAR
- If you find that your EAR has increased from 10s of Kb to around 12Mb - verify that the default checkbox of package is not enabled on your EclipseLink or Hibernate libraries on your EAR, EJB-jar and WAR. Normally you reference server modules and do not include them as application libraries in your EAR.