Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

EclipseLink/Examples/JPA/IDE/NetBeans

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

Netbeans 6.8

  • EclipseLink 2.0.1
  • Hibernate 3.2.5
  • Spring MVC 2.5
  • STruts 1.3.8

Netbeans 6.9.1

  • EclipseLink 2.0.2

Netbeans 7.0

  • 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

EclipseLink library

  • http://dlc.sun.com.edgesuite.net/glassfish/3.1/promoted/
  • 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
C:\opt\nb691\java\modules\ext\eclipselink\eclipselink-2.0.2.jar
C:\opt\nb691\java\modules\ext\eclipselink\eclipselink-javax.persistence-2.0.jar
  • You will likely want to regenerate the source as well, execute the following ant script off your 2.2 trunk view.
C:\view_22a\2.2\trunk>ant package-src-jar
  • 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

Netbeans691 upgrade eclipselink 202 to 22.JPG

  • Update the 6 OSGI bundles and the JPA 2.0 specification jar in GlassFish 3 here
C:\opt\nbglassfish301\glassfish\modules\org.eclipse.persistence.jpa.jar
C:\opt\nbglassfish301\glassfish\modules\org.eclipse.persistence.jpa.modelgen.jar
C:\opt\nbglassfish301\glassfish\modules\org.eclipse.persistence.core.jar
C:\opt\nbglassfish301\glassfish\modules\org.eclipse.persistence.asm.jar
C:\opt\nbglassfish301\glassfish\modules\org.eclipse.persistence.antlr.jar
C:\opt\nbglassfish301\glassfish\modules\org.eclipse.persistence.oracle.jar
C:\opt\nbglassfish301\glassfish\modules\javax.persistence.jar

Troubleshooting

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.

References

Back to the top