Uploaded image for project: 'Application Server 7'
  1. Application Server 7
  2. AS7-5062

PersistenceUnitRootURL for JPA providers may not be spec compliant

XMLWordPrintable

      Discussion on the EclipseLink bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=383200 ("On JBoss AS 7, EclipseLink doesn't find entity classes unless they're explicitly listed in persistence.xml") suggests that JBoss AS 7 may not be providing a spec-compliant PersistenceUnitRootURL or contents.

      EclipseLink can't scan the contents of a deployment for @Entity annotated classes, so it doesn't find any entities unless they're explicitly named in persistence.xml .

      http://docs.oracle.com/javaee/6/api/javax/persistence/spi/PersistenceUnitInfo.html#getPersistenceUnitRootUrl() states:

      java.net.URL getPersistenceUnitRootUrl()

      Returns the URL for the jar file or directory that is the root of the persistence unit. (If the persistence unit is rooted in the WEB-INF/classes directory, this will be the URL of that directory.) The URL will either be a file: URL referring to a jar file or referring to a directory that contains an exploded jar file, or some other URL from which an InputStream in jar format can be obtained.

      Returns: a URL referring to a jar file or directory

      ... and that's what EclipseLink expects. However, for EclipseLink class scanning to function correctly an adapter class must be provided, such as the classes provided here:

      https://community.jboss.org/wiki/HowToUseEclipseLinkWithAS7

      to integrate EclipseLink with JBoss's VFS.

      It may be worth investigating why this is necessary and whether the current behavior is standards compliant.

              smarlow1@redhat.com Scott Marlow
              ringerc_jira Craig Ringer (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: