Hi Kurt,
Thanks for the pointer but I'm still clueless about the client side code.
Could you please tell me how would a client can get all the cars (including
SportsCars) by calling just one findByXXX() method.
thanks for your help,
Tom.
>Use proxy objects, and implement your inheritance relationships there,
>instead.
>
>For example,
>
>public class CarHomeProxy
>{
> private CarHome _carHome;
>
> public Car findByPrimaryKey(CarPK carPK)
> {
> return _carHome.findByPrimaryKey( carPK );
> }
>}
>
>public class SportsCarHomeProxy extends CarHomeProxy
>{
> private SportsCarHome _sportsCarHome;
>
> public Car findByPrimaryKey(CarPK carPK)
> {
> // You might want to check here thet carPK is actually
> // an instance of SportsCarPK before continuing...
>
> return _sportsCarHome.findByPrimaryKey( (SportsCarPK)carPK );
> }
>}
>
>...you get the idea. The SportsCarBean must extend CarBean, SportCarPK must
>extend CarPK, and SportCar must extend Car. It's pretty convoluted, but
>this
>approach is probably the best way to go about getting the sort inheritance
>relationships you desire.
>
>KurtC
>
>
>-----Original Message-----
>From: Tom Lepski [mailto:[EMAIL PROTECTED]]
>Sent: Monday, August 07, 2000 5:11 PM
>To: [EMAIL PROTECTED]
>Subject: Re: A design question...
>
>
> > >Consider that I have two classes Car and SportsCar where SportsCar
> >extends
> > >Car. Now, the system has objects of both classes. I want to model this
> > >relationship in entity beans. How should I go about it? Can I have two
> > >entity bean classes.. CarBean and SportsCarBean?
> >You can use implementation inheritance to make SportsCarBean a subclass
>of
> >CarBean. You can also use interface inheritance for the remote interface.
>
>But, my SportsCar bean HAS to extend EntityBean. How can I have
>implementation inheritance here?
>
>
> >
> >The problem is with the Home interface:
> >
> >public interface CarHome extends javax.ejb.EJBHome {
> > Car findByPrimaryKey(CarKey key)
> > }
> > public interface SportsCarHome extends CarHome {
> > SportsCar findByPrimaryKey(CarKey key);
> > }
>
>findByPrimaryKey() in SportsCar cannot return SprotsCar because then the
>return types won't match.
>
>Also, when I retrieve all the cars, I should also get SportsCars. I can't
>call two findByXXX() methods (one for Car and one for SportsCar) to
>retrieve
>all the cars.
>
>Please help,
>Tom.
>
>________________________________________________________________________
>Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
>
>===========================================================================
>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".
>
>===========================================================================
>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".
>
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
===========================================================================
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".