Hi,

>From a JPA specification standpoint, the right way to handle this is
to make the AbstractObject class be a @MappedSuperclass, instead of an
@Entity. That basically means that it's a persistent type, but not one
that manages its own identity. The limitation is that (per the spec)
you can't have relationships to @MappedSuperclass types, and you can't
query for them.

There are other OpenJPA-specific options that you could use, too, but
if it's appropriate for you, the @MappedSuperclass approach is
probably the best, from a portability standpoint.

-Patrick

On 9/4/07, Christian Eugster <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I try to build a database on some hierarchical java-classes:
>
> I have a superclass, say AbstractObject, with an identity field named id.
> Subclasses inherit that field, but in the database tables I use for every 
> subclass another name for the id-column. I cannot see how I can do that, 
> because the annotation for the id field is done on the superclass. Is there a 
> way to map the one and only id field in the superclass to the id columns in 
> the database tables with different names?
>
> I read the manual, but have not seen a solution for it. Do you know any?
>
> Thanks!
>
> Christian
> --
> ****************************
> Christian Eugster
> Grissian Widum 14
> I-39010 Tisens
> --------------------------------------
> Handy Schweiz: 0041 79 594 85 45
> Handy Italia: 0039 333 888 77 64
> Email: [EMAIL PROTECTED]
>
>
> Psssst! Schon vom neuen GMX MultiMessenger gehört?
> Der kanns mit allen: http://www.gmx.net/de/go/multimessenger
>


-- 
Patrick Linskey
202 669 5907

Reply via email to