Sacha

OK to get an EJB entity bean instance I have to:

Get its home interface
Ask the home interface for a specific instance
I get back a remote interface.

If I have, say, 3 classes:
SimpleCustomer
CorporateCustomer extends SimpleCustomer
RetailCustomer extends SimpleCustomer
=>CorporateCustomerHome extends SimpleCustomerHome etc etc

If EJBland supported inheritance I should be able to do the following
without any extra coding:

lookup SimpleCustomerHome and call a finder on it that gives me back a
collection of all matching instances of SimpleCustomer, RetailCustomer and
CorporateCustomer.

It doesn't.

If I want it to do this I have to implement the finder methods of
SimpleCustomer to ALSO lookup RetailCustomer and CorporateCustomer. And if I
add a new sub-class of SimpleCustomer then I have to modify SimpleCustomer's
finder methods to handle the new sub-class. The parent has to know about its
children - a pain to develop and a maintenance nightmare.

If however you are willing to code this all yourself and do it completely
(and don't forget to map it to the underlying DB correctly) then you can
have "proper" inheritance. (Oh and don't forget, you shouldn't really use
normal java casting for remote objects).

Hope this is clear now, cos I ain't going to go into any more detail :-)

Edward

-----Original Message-----
From: Sacha Labourey [mailto:[EMAIL PROTECTED]]
Sent: 05 February 2001 09:54
To: jBoss
Subject: RE: [jBoss-User] IsA behaviour when inheriting beans


Hello Edward,

I'll try to explicit a bit more what you say in order to understand better.

You mean that the proxy that I receive as its own base class and it only
"looks like" my remote interface => when asking it about its class I receive
information about itw own proxy base class but I am able to invoke remote
interface methods on it.

Consequently, If I want to be able to "mimic" the isa behaviour, I need to
add a method signature, for example "myKindIs():String" and invoke it on the
proxy to know to whom I am speaking => I get an extra network round trip
delay.

correct?

If this is correct, it is quite sad... Any hint on how to give some hapiness
on this topic?

Cheers,


                        Sacha



> -----Message d'origine-----
> De : [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]De la part de Kenworthy, Edward
> Envoyé : lundi, 5 février 2001 10:40
> À : 'jBoss'
> Objet : RE: [jBoss-User] IsA behaviour when inheriting beans
>
>
> If what you are getting back is not an EJB then it will behave
> normally. If
> it is an EJB then it won't unless you explicitly code it (*and*,
> this is the
> real killer, its parent) to work like that.
>
> -----Original Message-----
> From: Sacha Labourey [mailto:[EMAIL PROTECTED]]
> Sent: 05 February 2001 09:14
> To: jBoss
> Subject: RE: [jBoss-User] IsA behaviour when inheriting beans
>
>
> Hello Edward,
>
> Thank you for your reply. I admit that the EJB spec does not support
> "component inheritance". What I am trying to figure out is how
> standard Java
> inheritance can be used withing EJB.
>
> My main interrogation is about the serialized proxy that is
> returned back to
> the client code. Does this proxy accuratly knows its class type? i.e. if a
> get back a base class type from a method call and this object is
> a proxy for
> an EJB, may I call instanceof on it to get information on its real target
> class? (i.e. more usable example below in my previous e-mail)
>
> I understand this behaviour as not being directly "component inheritance"
> but rather more standard java inheritance behaviour.
>
> Do you follow me ?
>
> Cheers,
>
>
>
>                               Sacha
>
>
> > -----Message d'origine-----
> > De : [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED]]De la part de Kenworthy, Edward
> > Envoyé : lundi, 5 février 2001 09:25
> > À : 'jBoss'
> > Objet : RE: [jBoss-User] IsA behaviour when inheriting beans
> >
> >
> > Inheritance isn't supported by the EJB spec'. You can get a sort of
> > fake-inheritance running BUT it will be very inconsistent (eg
> > sometimes the
> > inheritance will work as expected sometimes it won't.)
> Personally I would
> > avoid it.
> >
> > -----Original Message-----
> > From: Sacha Labourey [mailto:[EMAIL PROTECTED]]
> > Sent: 02 February 2001 10:50
> > To: jBoss
> > Subject: [jBoss-User] IsA behaviour when inheriting beans
> >
> >
> > Hello,
> >
> > I've got some questions regarding inheritance in Jboss.
> >
> > Imagine these RI:
> >     - interface ABusiness ...
> >     - interface A extends ABusiness, EJBObject ...
> >
> > a son of A:
> >     - interface B1Business extends ABusiness ...
> >     - interface B1 extends B1Business, A ...
> >
> > another son of A, brother of B1:
> >     - interface B2Business extends ABusiness ...
> >     - interface B2 extends B2Business, A ...
> >
> >
> > If I have a method of antoher Bean which returns a base class A, is it
> > possible to use a instanceOf behavior on the client side to
> decide which B
> > it is:
> >
> >     A = myOtherBean.getBObject (); // return type is A
> >     if (A instanceof B1) ...
> >
> >
> > In the same way, what about returned sequences?
> >
> >     mySequence = myOtherBean.getManyObjects (); // a sequence of base
> > interface
> > A
> >     if (mySequence.elementAt(0) instance of B1)...
> >
> >
> > Does this works automagically? Will the client side proxy knows
> > its accurate
> > distant object type?
> >
> > thank you. Cheers,
> >
> >
> >
> >                                     Sacha
> >
> >
> >
> > --
> > --------------------------------------------------------------
> > To subscribe:        [EMAIL PROTECTED]
> > To unsubscribe:      [EMAIL PROTECTED]
> > List Help?:          [EMAIL PROTECTED]
> >
> >
> > --
> > --------------------------------------------------------------
> > To subscribe:        [EMAIL PROTECTED]
> > To unsubscribe:      [EMAIL PROTECTED]
> > List Help?:          [EMAIL PROTECTED]
> >
> >
>
>
>
> --
> --------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> List Help?:          [EMAIL PROTECTED]
>
>
> --
> --------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> List Help?:          [EMAIL PROTECTED]
>
>



--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
List Help?:          [EMAIL PROTECTED]


--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
List Help?:          [EMAIL PROTECTED]

Reply via email to