Hi, all,
EJB inheritance is broken - EJBs were not meant for true inheritance.
Try this:
class DogBean extends PetBean...
class CatBean extends PetBean...
Dog fido = dogHome.create("Fido");
fido = (Dog) PetHome.findByPrimaryKey("Fido");
and you will get a ClassCastException. Try this with a real O/R mapper
like Hibernate and it will work!
Try this:
class PersonBean implements EntityBean
{
void addPet (Pet p) { ... };
List getPets() { ... };
}
Dog fido = dogHome.create("Fido");
Person myself = personHome.create("Matthias");
myself.addPet (fido);
fido = (Dog) myself.getPets().get(0);
and you will get a ClassCastException. Try that with Hibernate and it
will work!
And so on and so on...
Matthias
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf
> Of Richard Kunze
> Sent: Tuesday, April 06, 2004 5:17 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [Andromda-devel] EJBv3.0 Cartdrige and Inheritance
>
>
> On Tuesday 06 April 2004 21:46, [EMAIL PROTECTED] wrote:
> > Hi Richard,
> >
> > this website :
> >
> > http://www.onjava.com/pub/a/onjava/2002/09/04/ejbinherit.html
> >
> > tell how do implement a polymorphic heritage with ejb CMP
> in weblogic.
> > (It's hard to believe but the Onjava site is serious)
> >
> > Have you already try it (under JBOSS)??
>
> Sure :-)
>
> > Is there a plan for support polymormhism in EJB Cartdrige???
>
> Its already in the EJB cartridge for AndroMDA 3.0. If I
> haven't overlooked
> something in the article (I've just skimmed through it and
> didn't read it
> thoroughly), the only real difference between their approach
> and the one in
> AndroMDA is that the AndroMDA EJB cartridge only allows
> inheritance from
> abstract base classes, not from concrete entities.
>
> The reason for this is even mentioned in the onjava article:
> "Not all EJB
> containers behave the same. Some vendors prohibit entity
> beans from extending
> other [entity bean] classes. This is due to the different ways the
> specification can be interpreted."
>
> Bye,
>
> Richard
> --
> Richard Kunze
>
> [ t]ivano Software, Bahnhofstr. 18, 63263 Neu-Isenburg
> Tel.: +49 6102 80 99 07 - 0, Fax.: +49 6102 80 99 07 - 1
http://www.tivano.de
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Andromda-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/andromda-devel