Mapping application classes to database tables

Related to, but a different issue to another one I’ve got going on here…

There’s obviously a close relation between the classes and the database tables you define for your application. In many cases they will be the same concepts and include many of the same values.

Are people using their table definition to ‘auto create’ their classes? It seems fairly plausable that, in a class constructor, you could pull up the table definition and declare class variables, use the datatypes for type checking etc.

Is there anything in this approach?

There are existing solutions that facilitate this approach to development. Google ‘Table Data Gateway’

ActiveRecord, DataMapper and ORM are other keywords you might find helpful when Googling.

Cheers,
Alex