Uploaded image for project: 'Geronimo'
  1. Geronimo
  2. GERONIMO-4928

In the JPA persistence.xml loading code, exclude-unlisted-classes handling not compliant with JPA3.0 spec

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.4
    • 3.0-M1
    • deployment, persistence
    • Security Level: public (Regular issues)
    • None
    • Patch Available

    Description

      EJB 3.0 JPA spec FR, section 6.2.1.6

      The set of managed persistence classes that are managed by a persistence unit is defined by using one or
      more of the following:[41]
      • One or more object/relational mapping XML files
      • One or more jar files that will be searched for classes
      • An explicit list of the classes
      • The annotated managed persistence classes contained in the root of the persistence unit (unless
      the exclude-unlisted-classes element is specified)

      further on in the same section

      All classes must be on the classpath to ensure that entity managers from different persistence units that
      map the same class will be accessing the same identical class.

      This says that if exclude-unlisted-classes is specified as true, then only the classes listed in <class> elements must be used in the PU. If it is specified as false, then the annotated classes must be included. It's the only thing that exclude-unlisted-classes affects. It doesn't affect classes from other units, and if false it doesn't say that <class> must be ignored, which is what the following code does in PersistenceUnitBuilder.java:

      PersistenceUnitBuilder.java line 310
      if (excludeUnlistedClasses) {
          gbeanData.clearAttribute("jarFileUrls");
      } else {
          gbeanData.clearAttribute("managedClassNames");
      }
      

      I removed the else block to leave:

      PersistenceUnitBuilder.java Patched
      if (excludeUnlistedClasses) {
          gbeanData.clearAttribute("jarFileUrls");
      }
      

      Without this Geronimo isn't JavaEE 5 compliant.

      Attachments

        1. external-jpa-entity-reference.patch
          0.4 kB
          Quintin Beukes

        Activity

          People

            djencks David Jencks
            quintin@last.za.net Quintin Beukes
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: