0 Replies Latest reply on Feb 4, 2002 6:49 PM by Harry LeBlanc

    CMP and inheritance

    Harry LeBlanc Newbie

      Here's an interesting question.
      If I have a bean class (say, CompanyBean), and I subclass the bean (say, OutletBean), can I specify different underlying tables/views using CMP?
      The app I'm working on needs for one company entity to wear multiple "hats", so the way I modelled the database is to have a CompanyRole crossref table, and side tables to hold additional data, and a view pulling them all together. Say, for example, ABC company is a Chain (they get bills from us) and an Outlet (we deliver goods to their door). There are two roles set up in the Role table, for chain and outlet, and the one Company record for ABC is linked to 2 CompanyRole records (basically a company foreign key & a role foreign key). When I want to treat ABC as an Outlet, I pull the data from a view named Outlet (which joins all the needful tables), and ditto when working with a Chain "entity."
      So.
      Screwy, I know, but my question is, if I directly subclass ChainBean & OutletBean from CompanyBean (so they inherit all the needful setters & getters for generic company stuff like company name), can I pull my beans from different underlying views by changing the descriptors for Chain & Outlet? Or will Company's descriptor override them?
      Oracle 8i is the underlying database on Linux w/Apache, but this question is more theoretical in nature, and platform shouldn't matter.
      Thanks!
      H