|
Hi
Matthias,
that's
right, but I can build an inheritance structure for the matching value objects,
too.
An
AnimalService session bean can coordinate the calls to the CatHome and the
DogHome and return an AnimalValue
which
means a DogValue object or a CatValue object. So the only problem is, that the
inheritance structure is fixed in the
service class and I cannot easily extend it only by adjusting the
AnimalService. To make it extensible one may use a kind
of
server side factory pattern, so the AnimalService can load its concrete bean
home classes from a config file. So this information
is
very helpful for me.
Can
you tell me, what happens in case of an EJB inheritance? Is it only an
inheritance of the remote interfaces from eachother
(Cat
extends Animal, Dog extends Animal) and the bean classes (DogBean and CatBean
extend AnimalBean) or happens
something additionally?
Something to the point, that I cannot cast ... Is there really no
possibility? Why can I not cast beans? Even not if I
implement
the
ejbLocateHome like this?
public
BaseCustomer ejbHomeLocate(String customerID) throws FinderException
{
//At this point, all base EJB classes must know their EJB subclasses... Context jndiCtx; BaseCustomerHome bHome; GoldCustomerHome gHome; PlatinumCustomerHome pHome; try { jndiCtx = new InitialContext(); bHome = (BaseCustomerHome)ctx.getEJBLocalHome(); gHome = (GoldCustomerHome)jndiCtx.lookup("GoldCustomerEJB"); pHome = (PlatinumCustomerHome)jndiCtx.lookup("PlatinumCustomerEJB"); } catch (NamingException e) { throw new FinderException("Cannot obtain JNDI initial context."); } BaseCustomer b=null; try { b = bHome.findByPrimaryKey(customerID); return b; } catch (FinderException e) { } try { b = gHome.findByPrimaryKey(customerID); return b; } catch (FinderException e) { } try { b = pHome.findByPrimaryKey(customerID); return b; } catch (FinderException e) { } throw new FinderException("Cannot find any bean with that key."); } Bye
and have a nice weekend
Thorsten
|
Title: Nachricht
- [Andromda-user] How to select Remote or LocalHome EJB dkernek2
- RE: [Andromda-user] How to select Remote or LocalHome... Matthias Bohlen
- Re: [Andromda-user] How to select Remote or LocalHome... Wouter Zoons
- [Andromda-user] Next Release Thorsten Lamby
- RE: [Andromda-user] Next Release Matthias Bohlen
- RE: [Andromda-user] Next Release Thorsten Lamby
- RE: [Andromda-user] Next Release Matthias Bohlen
- RE: [Andromda-user] Next Release Thorsten Lamby
- RE: [Andromda-user] Next Rel... Matthias Bohlen
- Re: [Andromda-user] Next Rel... Richard Kunze
- RE: [Andromda-user] Next Rel... Thorsten Lamby
- Re: [Andromda-user] Next Rel... Richard Kunze
