openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralf Ebert (JIRA)" <>
Subject [jira] [Commented] (OPENJPA-2360) ClassCastException: DetachedValueStateManager cannot be cast to StateManagerImpl
Date Wed, 08 May 2013 08:29:19 GMT


Ralf Ebert commented on OPENJPA-2360:

Yeah, turns out you're right. Patch doesn't fix our problem. At least in my case.

Running with the proposed fix causes another problem a few lines later:
Caused by: java.lang.UnsupportedOperationException
	at org.apache.openjpa.kernel.DetachedValueStateManager.setObjectId(

I don't know how or why, but somehow OpenJPA confuses the object state. The entity it wants
to update is in attached state but somehow a DetachedValueStatemanager gets involved which
turns out bad. I'm in now way an OpenJPA-expert but this is how it looks to me.

I ran into the ClassCastException-problem while working around another problem. My application
called merge on an attached object. According to the documentation this call should be ignored.
But it wasn't. OpenJPA decided to override my changes to the attached entity with the current
state from the database and persist that. But only on one property (boolean), not on an other
(String). So there is already some object state confusion present which possibly also causes
this ClassCastException-problem.
I hope this is of any help...
> ClassCastException: DetachedValueStateManager cannot be cast to StateManagerImpl
> --------------------------------------------------------------------------------
>                 Key: OPENJPA-2360
>                 URL:
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc, kernel
>    Affects Versions: 2.2.1
>            Reporter: Guillaume Chauvet
>            Priority: Blocker
>         Attachments: OPENJPA-2360.patch
> The corresponding stacktrace :
> ==========================================
> Caused by: <openjpa-2.2.2-QFD-r422266:1446687M nonfatal general error> org.apache.openjpa.persistence.PersistenceException:
org.apache.openjpa.kernel.DetachedValueStateManager cannot be cast to org.apache.openjpa.kernel.StateManagerImpl
> 	at org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(
> 	at org.apache.openjpa.kernel.LocalManagedRuntime.commit(
> 	at org.apache.openjpa.kernel.BrokerImpl.commit(
> 	at org.apache.openjpa.kernel.DelegatingBroker.commit(
> 	at org.apache.openjpa.persistence.EntityManagerImpl.commit(
> 	... 39 more
> Caused by: java.lang.ClassCastException: org.apache.openjpa.kernel.DetachedValueStateManager
cannot be cast to org.apache.openjpa.kernel.StateManagerImpl
> 	at org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flushAndUpdate(
> 	at org.apache.openjpa.jdbc.kernel.BatchingPreparedStatementManagerImpl.flushAndUpdate(
> 	at org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flushInternal(
> 	at org.apache.openjpa.jdbc.kernel.PreparedStatementManagerImpl.flush(
> 	at org.apache.openjpa.jdbc.kernel.ConstraintUpdateManager.flush(
> 	at org.apache.openjpa.jdbc.kernel.ConstraintUpdateManager.flush(
> 	at org.apache.openjpa.jdbc.kernel.BatchingConstraintUpdateManager.flush(
> 	at org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(
> 	at org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(
> 	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.flush(
> 	at org.apache.openjpa.kernel.DelegatingStoreManager.flush(
> 	at org.apache.openjpa.kernel.BrokerImpl.flush(
> 	at org.apache.openjpa.kernel.BrokerImpl.flushSafe(
> 	at org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(
> 	... 43 more

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message