Hi there !
Imagine that in your application you want to manage documents. For this you have in your database a DOCUMENTS table. This table has a column named DOC_TYPE. As the name says, this colomn gives the type of the document (for exemple txt, doc, xls, ppt , htm...).
On the java side you have a Document class mapped to this DOCUMENTS table. But we also have subclasses like TxtDocument, DocDocument, XlsDocument... inheriting from the Document class.
What I would like to do, is to get a list of documents, but this list will not contain Document objects, but the corresponding Document sublcass of the DOCUMENTS.TYPE field.
For exemple, if DOCUMENT.TYPE = 'doc' -> DocDocuement class, if DOCUMENT.TYPE = 'xls' -> XlsDocument class....
Any idee of how to implement it ?
|