One of the problems with database driven applications is that a large amount of SQL syntax gets stored in the application code.
This starts to cause more problems as the database and applications grows because refactoring database tables meant not catching all of the issues at compile-time.
The Cohesion code-generator creates an enumerated type for each database table with the names of every field that all generate a simple common interface.
These fields are then referenced together to form queries that are checked at compile time. At run-time, each field can be looked up to find the respective column, and table. By using foreign keys the joins can be determined automatically and a complete statement produced.
The Cohesion Report tool takes a compile-time query and generates a full SQL statement for the report. Since every field can be inspected for it's type and relationships, a lot of settings can be completely automatic.
There were several attempts at getting rid of query strings before this method was used. It was so successful that nearly every query has been replaced with this reduced compile-time syntax.
With Cohesion, major database refactoring can occur and after the new code is generated all places that are affected show up as compile errors.