I, like Rob, am curious about the exact relationship b/w person and employee.  But as an FYI, I use an abstract class to define a generic DAO object that implements the public Save, Read, etc methods and leaves the implementation details of the private functions that actually do the work up to anyone inheriting from the baseDAO class. I have not had needed to inherit from a class that implements the baseDAO, e.g. employeeDAO implements personDAO which implements baseDAO.  I do however have a DAO use another DAO for the 'has-A' type of relationship. 

E.g. A Person 'has-an' Address. (Note: Assumption for this example is a person has 1 address)
DB has 2 tables, person & address with an addressID in person that is foreign key to address.  To help illustrate separation of domain model and database model I'm going use 1 bean object, personObj that contains all the address info, e.g. personObj.getState(), and not create 2 separate bean objects, personObj & addressObj.  However I do have 2 DAO's, personDAO & addressDAO use to access table persisted data.  The Save method in the personDAO takes personObj.  Within the personDAO it would use the addressDAO to do the CRUD work for the address portion of the personObj and the personDAO for the contact portion of the personDAO.   So my domain model has a person concept but my db has an address and person table, i.e. the domain and data model are separate.

Now, there are tools and frameworks that would and do create bean objects based database table relationships to help speed up development and eliminate hand coding CRUD stuff.  So whether you use the bean = table concept or bean = domain which may or may not = table or an automagic framework to deal with it for you is up to you.  Personally I'm still undecided on which method is best at this time.

-Jason

John Samson wrote:
I have a base object 'person' for which I have defined both a personObj to hold information and a personDAO to handle persistance. My person DAO has a getById() function which takes a uuid and returns a cfc of type personObj.
 
I now want a new object 'employee' so I create an employeeObj which extends person, and to handle the persistance I create a employeeDAO which extends personDAO. employee DAO also has a getById() function which takes a uuid and should return a cfc of type employeeObj.
 
My employeeDAO.getById() function is causing me problems. I am trying to call super.getById() but this returns an object of type personObj rather than employeeObj.
 
How can I leverage the DAO code I have written in the parent object?
 
John
 
 


To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. ----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to cfcdev@cfczone.org with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org

-- 
Jason Daiger
URL: www.jdaiger.com
EML: [EMAIL PROTECTED]





----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to cfcdev@cfczone.org with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org

Reply via email to