I used a Java tool called DODS, which was developed by ca. 2000 with the Enhydra application server. DODS is still here: http://www.enhydra.org/tech/dods/
How DODS works, and which matches your purpose of checking compile time, is that it is a code generation tool. It generates Java classes matching the tables in your database. The object instances of these classes have getters and seters for each column in the table. Of course, if you change the structure of your database, you will have to regenerate the Java code using DODS.
As long as you keep the generated code up-to-date with the structure of your database, it provides compile-time checks that any application code that uses these classes requests valid tables and columns.
In any case, I understand that you have noted your question in C # and ASP.NET. The tool that generates Java code will not be so useful to you. But for .NET, there may be another tool that works on the same principle of code generation, which maps to the database structure. Therefore, I would suggest narrowing your search to .NET ORM tools that say something about code generation.
source share