This is slightly tangental, but I'm going to recommend staying far far away from RuntimeEnhancement. There are numerous known issues with that enhancement strategy and you'll save yourself a number of headaches if you stay away from it. I'd set the following property[1] to disable this support.
[1] <property name="openjpa.RuntimeUnenhancedClasses" value="unsupported"/> Thanks, Rick On Fri, Jun 3, 2011 at 12:10 PM, infinity2heaven <[email protected]>wrote: > I get two very different errors when using the default RuntimeEnhancement > and > using build-time enhancements: > > Runtime: > I get a classCast for my entity Foo. > java.lang.ClassCastException: > org.apache.openjpa.enhance.ReflectingPersistenceCapable incompatible with > xxx.entity.Foo > > Build-time: > App doesn't load. > java.lang.NoSuchMethodError: xxx/BaseEntity.pcGetManagedFieldCount()I > at xxx.entity.ProfileLoadError.<clinit>(ProfileLoadError.java) > at java.lang.J9VMInternals.initializeImpl(Native Method) > at java.lang.J9VMInternals.initialize(J9VMInternals.java:200) > at java.lang.Class.forNameImpl(Native Method) > at java.lang.Class.forName(Class.java:136) > > My persistence.xml > <persistence xmlns="http://java.sun.com/xml/ns/persistence" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://java.sun.com/xml/ns/persistence > http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" > version="1.0"> > > <persistence-unit name="tcms-profile" > transaction-type="RESOURCE_LOCAL" > > > <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider> > > <class>xxx.jpa.BaseEntity</class> > <class>xxx.entity.Foo</class> > <class>xxx.entity.ProfileAudit</class> > <class>xxx.entity.ProfileAuditDetail</class> > > <properties> > <property name="openjpa.jdbc.Schema" value="xyz"/> > </properties> > </persistence-unit> > </persistence> > > What am I missing? > > Really. Two different errors based on openjpa's "enhancement." > -- *Rick Curtis*
