Title: Nachricht
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
 
 
-----Original Message-----
From: Matthias Bohlen [mailto:[EMAIL PROTECTED]
Sent: Friday, December 05, 2003 11:01 AM
To: 'Thorsten Lamby'; [EMAIL PROTECTED]
Subject: RE: [Andromda-user] Next Release

Hi Thorsten,
 
next week, there will only be a maintenance release (2.1.1) that fixes the build.xml bug in the empty sample project wizard for Hibernate 2 projects. Support for abstract EJB inheritance is already in the code base of AndroMDA 3.x (see the HEAD branch in CVS). You may try it already if you do a CVS checkout and build AndroMDA from the sources which is only a matter of one line in a properties file and a call to "ant".
 
About EJB inheritance: There is no REAL inheritance in EJB. For example: Create three beans, call them AnimalBean, DogBean and CatBean. Let DogBean and CatBean inherit from AnimalBean. Let all the interfaces inherit, too. Then, call DogHome.create("fido") and CatHome.create("pussy"). Then, call AnimalHome.findByPrimaryKey("fido"). Surprise, surprise: You will get an AnimalBean, not a DogBean and you will NOT be able to cast. You see what happened?
 
So all that we do in the AndroMDA 3.x EJB cartridge is abstract inheritance. The base classes themselves cannot create instances and cannot find instances of derived classes.
 
Cheers...
Matthias
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Thorsten Lamby
Sent: Thursday, December 04, 2003 11:23 PM
To: [EMAIL PROTECTED]
Subject: [Andromda-user] Next Release

Hi Matthias,
 
you talked about a new release next week.
Is the support for EJB inheritance inside this release?
Someone told me you are working on this ...
For the value objects I adjusted the VSL file to solve this problem.
I think it is more difficult for the entity bean classes, because of the home interface, isn't it. In an article about this
inheritance problem I read that one have to implement ejbHomeLocate methods in the base bean class to reference
the subclass beans. Is that right?
 
Cheers
Thorsten
 
 

Reply via email to