Code generation is a good technique when generating static classes from a database, but it goes both ways allowing class changes to be pushed into the database.

Code generation is a very useful technique to generate domain classes from a schema.

Hand-tooling classes for a large number of tables will quickly become burdensome and prone to type mapping errors.

The Cohesion code generator generates classes from tables with enough information that the tables can be recreated in another database and changes made in the tables can generate a script to alter an existing database.