Hi,
You should define a Inheritance strategy. If you are using SINGLE_TABLE
strategy then you should also define a Discrimnator value for each subclass.
Marc Logemann wrote:
>
> Hi,
>
> following domain model:
>
> @MappedSuperclass
> public class BasicMetaData {
>
> @Id
> @Column(name = "oid")
> private long oid;
> ...
> }
>
> @Entity
> @VersionColumn(name = "jdoversion")
> @Table(name = "foo1")
> public class MetaData1 extends BasicMetaData {
> }
>
> @Entity
> @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?
>
>
> Marc
>
>
>
>
>
--
View this message in context:
http://n2.nabble.com/same-%40Id-on-mapped-superclass-tp2435374p2445639.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.