openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gopalakrishnan U <gopalakrishn...@gmail.com>
Subject Re: support for identifying relations in JPA/OpenJPA
Date Thu, 31 Jul 2008 06:34:29 GMT
Hi Pinaki,

That was valuable information, Thanks!

I tried to implement identifying relations with three entities X, Y and 
Z having a relation
X  --< Y --< Z  ( --< = Identifying relation in craw feet notation). But 
persisting of Z is failing
with the following exception:

<openjpa-1.1.0-r422266:657916 nonfatal general error> 
org.apache.openjpa.persistence.PersistenceException: 
org.apache.openjpa.util.ObjectId
    at org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2459)
    at org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2359)
    at org.apache.openjpa.kernel.BrokerImpl.persistAll(BrokerImpl.java:2305)
    at 
org.apache.openjpa.kernel.SingleFieldManager.persist(SingleFieldManager.java:266)
    at 
org.apache.openjpa.kernel.StateManagerImpl.cascadePersist(StateManagerImpl.java:2884)
    at org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2454)
    at org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2359)
    at org.apache.openjpa.kernel.BrokerImpl.persistAll(BrokerImpl.java:2305)
    at 
org.apache.openjpa.kernel.SingleFieldManager.persist(SingleFieldManager.java:266)
    at 
org.apache.openjpa.kernel.StateManagerImpl.cascadePersist(StateManagerImpl.java:2884)
    at org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2454)
    at org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2277)
    at 
org.apache.openjpa.kernel.DelegatingBroker.persist(DelegatingBroker.java:1021)
    at 
org.apache.openjpa.persistence.EntityManagerImpl.persist(EntityManagerImpl.java:645)
    at jpatest.TestXYZ.setup(TestXYZ.java:63)
....
Caused by: java.lang.ClassCastException: org.apache.openjpa.util.ObjectId
    at jpatest.Z.pcCopyKeyFieldsToObjectId(Z.java)
    at 
org.apache.openjpa.util.ApplicationIds.create(ApplicationIds.java:403)
    at org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2430)
    ... 38 more

Any clue what I could be doing wrong, or is this an OpenJPA problem?

An eclipse project containing X,Y,Z, a test case and necessary build 
scripts is attached.

Thanks
Gopal

Pinaki Poddar wrote:
> Hi,
>   
>> Does OpenJPA support identifying relationship (a.k.a compound identity
>> relations) between two entities?
>>     
>
> Yes. OpenJPA supports relation as identity. JPA 2.0 will standardize on this
> feature as 'derived identity'. This feature is described and demonstrated in
> OpenJPA manual [1]. A JIRA issue where multi-level derived identity is being
> used can be found here [2]. 
>
> [1]
> http://openjpa.apache.org/docs/latest/manual/manual.html#ref_guide_pc_oid_entitypk
> [2] http://issues.apache.org/jira/browse/OPENJPA-207
>
>
>   


Mime
  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message