Hi!
i'm trying to reuse a legacy database (from COBOL)
with entity beans (BMP).
The database describe a structure like this: Product,
Share extends Product, Warrant extends Product etc.,
all this described in only one table (with more than
200 fields!!).
In many articles i read is possible inherit entity
beans, i did it, and seems work, at least with JBoss,
what i'm not able to do i query the base class
(Product) and load the right entity depending on a
discriminator field.
For example, if i query the Product, i get only
instances of Product also when is Share or Warrant,
example:
productHome.findByPriceRange(a,b);
...
while( itr.hasNext() )
{
if ( itr.next() instanceof Product )
{
// Wrong! Was a Share!
}
}
I tought also about write a session bean that query
the database, read the primary key and the
discriminator and calls findByPrimaryKey() on the
home.
It's the only way or there is something better?
Any help or link to articles/examples is welcome!
In EJB2.0 will be the same, or there will be an easier
way for handle this problem? (very common case in OOP
i think)
Thank you very much,
David
__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user