Looks like enhancement of entity classes are taking place at runtime. Will it
be possible to verify if the behavior differs for build-time enhancement?

Runtime enhancement can be switched off with
     <property name="openjpa.RuntimeUnenhancedClasses" value="unsupported"/>
 

Stefan Handschuh wrote:
> 
> Assume there is a class MyObject with an java.lang.Integer constructor
> and a method "public java.lang.Integer getCode()".
> Also there is a second class, which will be persistet an which contains a
> field
> 
> @Persistent
> @Externalizer("getCode")
> private MyObject myObject;
> 
> If I try to persist a instance of this second class, the following error
> occurs:
> 
> Caused by: java.lang.ClassCastException: some.package.MyObject cannot
> be cast to java.lang.Integer
>        at
> org.apache.openjpa.enhance.ReflectingPersistenceCapable.pcProvideField(ReflectingPersistenceCapable.java:98)
>        at
> org.apache.openjpa.kernel.StateManagerImpl.provideField(StateManagerImpl.java:2959)
>        at
> org.apache.openjpa.kernel.StateManagerImpl.preFlush(StateManagerImpl.java:2774)
>        at
> org.apache.openjpa.kernel.PNewState.beforeFlush(PNewState.java:39)
>        at
> org.apache.openjpa.kernel.StateManagerImpl.beforeFlush(StateManagerImpl.java:940)
>        at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1892)
>        at
> org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:1852)
>        at
> org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1770)
>        ... 38 more
> 
> 
> The same is reproducable with the code of the documentation (types:
> URL, Class) concerning externalizers.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/%40Externalizer-in-1.0.1-does-not-work-on-persist-tp14567517p14568581.html
Sent from the OpenJPA Developers mailing list archive at Nabble.com.

Reply via email to