Description:
The field and table names (or typos therewith) are a frequent source of errors when using connector/j:
First, the need to be correct in the prepared-statements and then, when getting values out of the Resultset into the business (or e.g. Struts ActionForm) Objects, all needs to be in sink again.
Unfortunately, this is a lot of typing and IDEs/compilers appear to have a hard time to help ==> often an error only gets noticed at run-time, i.e. after compilation, deployment (e.g. of a web application) and then possibly only in the course of a lengthy test.
Therefore, it would be great to have a scriptable mechanism (that can be triggered for example out of ant's build.xml) that produces a set of string constants to be used when creating queries. This way,
- the compiler will catch quite some typos
- maintainability is largely increased when a field name needs to be changed/dropped for whatever reason.
Therefore my suggestion:
Document in http://www.mysql.com/documentation/connector-j/index.html how one can generate a structured (xml or java directly) field and table list:
- are there tools working on the basis of the mysql-client or server
- are there parsers of loadDbScheme.sql files (since I use a tool to generate this [ChilliSource DDS-Lite], I guess this tool is the ultimate origin of the field names to take)?
- ...
P.S.: I am using xml files and the http://sourceforge.net/projects/fmpp pre-processsor to create similar constant files to keep the string-variables used in the various parts of the struts MVC in synch - i.e. the variables used in the view (jsp files, content.properties) as well as in the controller (Struts*Actions.java) are both generated from one single source.
How to repeat:
all the time
Suggested fix:
having such a tool would make implementation much more efficient, i.e. a lot less error searching