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

PersistenceUnitInfo.addTransformer(ClassTransformer transformer) needs to occur before class definition

    XMLWordPrintable

Details

    Description

      Using the Hibernate property in a persistence.xml should result in the hibernate.ejb.use_class_enhancer application entity classes being enhanced by Hibernate. But this only works before the classes are loaded.

      The same problem also has been reported by community users trying to use similar features with Versant/OpenJPA (EclipseLink will probably have the same issue).

      Question: What happened to the AS7-2233 changes? Answer, AS7-2233 only fixed enough so to avoid some errors that were occurring but not enough for complete class_enhancer support.

      Note that there was IRC discussion about the other ways to address this on #jboss-as7 (I'll attach a transcript later).

      One possible solution:

      • Only if classes are being enhanced or could be enhanced, would the other below steps be taken.
      • When deploying the deployment persistence unit definitions, create a new application level classloader (similar to temp classloader).
      • PersistenceUnitInfo.getClassLoader() will return the new classloader.
      • Each entity manager invocation will set the TCCL to the PersistenceUnitInfo.getClassLoader().

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: