Inherited classes and DB mapping

I'm considering purchasing Aurelius but have a few questions.


1) Is it best to make each class its own table?  i.e. I'm considering using a TPerson class and TPatient, TPhysician and TUser inherit from this class.  Of course there isn't a TPerson table, but there will be a Patient, Physican and User table.  Is this ok do this or is it best not to inherit from a class?

2) Is it best to place each of the classes in it's own source code file (like java) or should they be combined into one big file?

Thanks for your guidance since I'd really like to use an ORM to help speed up development.

Jim

Hello,


1) It really depends on your model, all options are available. You can have an inheritance hierarchy like you said, and you can have a table for TPerson or not. If you are not going to have a table for TPerson, you have to map each field in the descendant class, even the inherited ones. Note that there is a limitation of Delphi/OOP itself, not Aurelius: you can't have an object to be both TPatient and TPhysician. So if you need that, you should not use inheritance but composition (have a TPatient class with a property Person: TPerson)

2) That's also up to you, it's not Aurelius related. For Aurelius it doesn't make a difference. But note Delphi doesn't allow circular references, so if you have bidirectional references you will have to put both classes (or the whole class structure) in the same unit anyway.