openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Logemann>
Subject same @Id on mapped superclass
Date Fri, 06 Mar 2009 12:32:35 GMT

following domain model:

public class BasicMetaData  {

     @Column(name = "oid")
     private long oid;

@VersionColumn(name = "jdoversion")
@Table(name = "foo1")
public class MetaData1 extends BasicMetaData {

@VersionColumn(name = "jdoversion")
@Table(name = "foo2")
public class MetaData2 extends BasicMetaData {

Now  i have a oid value of "1" in the DB for MetaData1. When i try to  
use also "1" as oid for MetaData2 and try to persist, i am getting an  
exception because Entity MetaData1 is somehow in the same "ID space".  
So is it correct that one cant define an ID field in a mapped  
Superclass when the IDs have their own "counter".

In this example, OpenJPA even thinks that MetaData2 is a detached  
instance of type MetaData1 because it looks in its cache and sees an  
OID with value 1 but for  complete different entity.

To make it short? I must define the OID field on the subclasses right?


View raw message