|Custom Byte Code Transformer [message #1234331]
||Tue, 21 January 2014 18:01
| Steve Widom
Registered: January 2014
I would like to add my own custom byte code transformer to the PersistenceUnitInfo used in EclipseLink. I am currently using EclipseLink-2.5.1-RC3 and have read the JPA standard sufficiently well to learn that I should be able to do this (at least I hope I read it sufficiently well).|
Essentially, my byte code transformer uses Javassist to add JPA annotations to the entity classes driven from metadata outside of EclipseLink and possibly add fields, methods, etc. to those entity classes.
I have been unsuccessful in getting this to work, and was wondering if you have any examples of this kind of thing. Strangely, I have configured my own JPA PersistenceProvider into my webapp running in Tomcat 7 (which DOES seem to be called by EclipseLink), by adding the name of the custom Provider into the META-INF/services/javax.persistence.spi.PersistenceProvider of my jar file (as specified by the JPA specification). However in the debugger I see that the PersistenceUnitInfo is always null, and I keep getting an error thrown that a PersistenceProvider cannot be found for all the entity classes in my persistence.xml file.
Any ideas? Does EclipseLink support a custom PersistenceProvider, and is there any way I can addTransformer() to my PersistenceUnits so that I can use byte code manipulations with Javassist?
Powered by FUDForum
. Page generated in 0.01917 seconds