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

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



      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().

        Gliffy Diagrams


            Issue Links



                • Assignee:
                  smarlow Scott Marlow
                  smarlow Scott Marlow
                • Votes:
                  0 Vote for this issue
                  1 Start watching this issue


                  • Created: