OpenJPA @Version Annotation Causes "Attempt to persist detached object exception" in Fuse 6
Issue
- Adding the @Version annotation to my Entity causes an exception even though it is never explicitly set in code.
1. Attempt to persist detached object exception Address: http://localhost:8181/cxf/test/testService/save Payload: {"id":null,"version":null,"createdBy":null,"created_Date":null,"lastModifiedBy":null,"lastModified_Date":null}
16:39:13,376 | WARN | qtp796321045-75 | PhaseInterceptorChain | 164 - org.apache.cxf.cxf-api - 2.7.0.redhat-610379 | Application {http://rest.persistence.test.com/}MyRestService has thrown exception, unwinding now org.apache.cxf.interceptor.Fault: Attempt to persist detached object "com.domain.Person@a26cf9f". If this is a new instance, make sure any version and/or auto-generated primary key fields are null/default when persisting.
2. @ManyToOne(optional=false) - optional=false not enforced - no work around found
Environment
-
Red Hat JBoss Fuse
- 6.x
-
OpenJPA
- 2.3
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.