Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Migrating Toplink Essentials/JPA 1.0 to EclipseLink/JPA 2.0 (OC4J 10.1.3)

783098Jul 5 2010 — edited Jan 19 2011
I'm having a bit of trouble here. The inital part of this was easy enough - changing persistence.xml to use EclipseLink persistence properties and adding Eclipselink.jar into my applib directory and then work through my unit tests to knock out bugs relating to EclipseLink being rather more strict on some aspects of relationship modelling than Toplink was. However, when I try to introduce a JPA 2.0 persistence.jar into the mix, it works (eventually) as long as I don't use any JPA 2.0 features eg EntityManager.getCriteriaBuilder. I'm using the latest EclipseLink so this is definitely supported (and it compiles and deploys fine) . I have also tried adding the persistence.jar and eclipselink.jar to the j2ee/<instancename>/applib directory and separately tried the same thing with a shared library as per this link:

http://wiki.eclipse.org/EclipseLink/Examples/JPA/OC4J_Web_Tutorial#Option_1:_Add_an_eclipselink_shared-library_to_OC4J_-_recommended

I also have tried adding -javaagent:Eclipselink jar in the JVM startup as a belt and braces to ensure the right jars are loaded, plus in my jdk/jre/lib/ext directory just in case.

All these work so no problem there and I've removed the JPA 1.0 persistence.jar completely but if I try to make a call at runtime to, say, EntityManager.getCriteriaBuilder, I get this error:


[junit] start fault message:
[junit] Internal Server Error (Caught exception while handling request: oracle.oc4j.rmi.OracleRe
moteException: java.lang.Exception: java.lang.AbstractMethodError: getCriteriaBuilder; nested except
ion is:
[junit] java.lang.Exception: java.lang.AbstractMethodError: getCriteriaBuilder)
[junit] :end fault message
[junit] java.rmi.ServerException:

The issue seems to be the Evermind proxy class com.evermind.server.ejb.persistence.EntityManagerProxy which is loaded but doesn't define getCriteriaBuilder or other JPA 2.0 methods ie it is a JPA 1.0 class (defined in oc4j_internals.jar). i can see debugging in Eclipse that this proxy class is what is loaded by OC4J to access the JPA 2 classes so I can see why I have the problem - but not how to get round it.

This is a different error to when I didn't have a JPA 2.0 persistence.jar loaded, when I got a NoSuchMethod exception, so I am reasonably confident (over confident?) that the right jars are loaded apart from the Oracle proxy above.

My question is - is there any way I can use JPA 2.0 features with Eclipselink in OC4J and how, or will I have to move to another app server eg WLS ? It is part of our plan to do so but I would rather not be forced into it right now if I can get round it, as there are a lot of changes I need to make in a lot of areas to make this so - release management, ant build and deploy tasks, plus our organisations own support which is OAS-based. Can I also be sure that EclispeLink is actually using the JPA 2.0 classes here and not some JPA 1.0 classes it might be findin gin the class path (but if we are not using JPA 2.0 features, I guess that doesn't much matter - right ?)

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 16 2011
Added on Jul 5 2010
4 comments
2,122 views