Uploaded image for project: 'Application Server 7'
  1. Application Server 7
  2. AS7-453 JPA 2.0 implementation
  3. AS7-569

handle JPA 8.2.1.6.1 Annotated Classes in the Root of the Persistence Unit

    • Icon: Sub-task Sub-task
    • Resolution: Done
    • Icon: Major Major
    • 7.0.0.Beta2
    • 7.0.0.Beta1
    • JPA / Hibernate
    • None

      JPA 8.2.1.6.1 Annotated Classes in the Root of the Persistence Unit

      All classes contained in the root of the persistence unit are searched for annotated managed persistence classes—classes with the Entity, Embeddable, or MappedSuperclass annotation—and any mapping metadata annotations found on these classes will be processed, or they will be mapped using the mapping annotation defaults. If it is not intended that the annotated persistence classes contained in the root of the persistence unit be included in the persistence unit, the exclude-unlisted-classes element must be specified as true.
      The exclude-unlisted-classes element is not intended for use in Java SE environments.

            [AS7-569] handle JPA 8.2.1.6.1 Annotated Classes in the Root of the Persistence Unit

            Fix at https://github.com/scottmarlow/jboss-as/commit/74f67c4673f20080317219326df40013b69a09ef seems to work correctly for deployment of annotated classes in root of pu.

            Scott Marlow added a comment - Fix at https://github.com/scottmarlow/jboss-as/commit/74f67c4673f20080317219326df40013b69a09ef seems to work correctly for deployment of annotated classes in root of pu.

            https://github.com/scottmarlow/jboss-as/commit/6c72ca83c75e19bb91de4416049e198a17686df0 contains the change to clear the reference to the Annotation Index after calling the provider.createContainerEntityManagerFactory() for the persistence unit service. The annotation index is only valid during deployment anyway. Also cleared the temp classloader reference as well (only good during call to provider.createContainerEntityManagerFactory()).

            Scott Marlow added a comment - https://github.com/scottmarlow/jboss-as/commit/6c72ca83c75e19bb91de4416049e198a17686df0 contains the change to clear the reference to the Annotation Index after calling the provider.createContainerEntityManagerFactory() for the persistence unit service. The annotation index is only valid during deployment anyway. Also cleared the temp classloader reference as well (only good during call to provider.createContainerEntityManagerFactory()).

            Scott Marlow added a comment - https://github.com/scottmarlow/jboss-as/commit/13f2f3a237a1acc24bfec8d4edee32809db7cc40 contains a fix that I am testing.

            Looks like we need to bring HackTLScanner to AS7 JPA...

            Scott Marlow added a comment - Looks like we need to bring HackTLScanner to AS7 JPA...

            Workaround: add to persistence.xml

            <class>services.entities.Address</class>
            <class>services.entities.Customer</class>
            <class>services.entities.DistributionCenter</class>
            <class>services.entities.Order</class>
            <class>services.entities.OrderLine</class>
            <class>services.entities.OrderLinePK</class>
            <class>services.entities.PricingMethod</class>
            <class>services.entities.Product</class>
            <class>services.entities.Region</class>
            <class>services.entities.RegionPK</class>

            Scott Marlow added a comment - Workaround: add to persistence.xml <class>services.entities.Address</class> <class>services.entities.Customer</class> <class>services.entities.DistributionCenter</class> <class>services.entities.Order</class> <class>services.entities.OrderLine</class> <class>services.entities.OrderLinePK</class> <class>services.entities.PricingMethod</class> <class>services.entities.Product</class> <class>services.entities.Region</class> <class>services.entities.RegionPK</class>

            Looks like we are already setting info.getPersistenceUnitRootUrl() to vfs:/content/OrderManagerApp.ear/OrderManagerEJB.jar/

            Debugging to see why that is not enough...

            Scott Marlow added a comment - Looks like we are already setting info.getPersistenceUnitRootUrl() to vfs:/content/OrderManagerApp.ear/OrderManagerEJB.jar/ Debugging to see why that is not enough...

              smarlow1@redhat.com Scott Marlow
              smarlow1@redhat.com Scott Marlow
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: