How do you model inheritance with EJB?

Imagine the following class graph:
classes:
A (abstract)
B extends A
C extends A
D
associations:
1 D associates n A

Using a relational database and having a
D-record you could query for the n A's
that satisfy the association using some-
thing like:

select <A-attributes> from B where B.ckey= ?
union
select <A-attributes> from C where C.ckey= ?

setting the "?" to the key of the D-record.
(This depends on you mapping.)

Using EJB I would like to call a finder to
A's Home-Interface which should return a
collection of A-instances - but that instan-
ces should be concrete B's or C's, which in
fact are A's too.
Sadly that is not possible. Using BMP the
finder must return the primary keys of B's
and C's and the container wraps them into
A-instances. Using CMP the container executes
the SQL-statement and wraps the primary keys
into A-instances too.

I do not want to build my own layer of mapping
for I think this is the responsibility of EJB.
Should I want it? Do you know a mapping tool
that satisfies multiple inheritance? TopLink?

I wonder how you model inheritance with EJB.

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to