Re: Where to store SQL statement



jsguru72 wrote:
I write a lot of JSP pages with backend classes to access MySQL
databases. One of my biggest problems is having the SQL statements
hardcoded in class.

Everytime I have to make a slight change to the sql statement, I have
to completely recompile the entire class. This is especially
troublesome during testing when I have to update the statements
numerous times until I get it just right.

Where should I be storing the statements?

Should I put them in a text file and read them in when needed? I have
thought of this, but I am concerned about the overhead of opening and
reading a file just to get a SQL statement.

Just trying to find out some ideas.

Either use SQL in the code as now and be patient when
recompiling or look at a persistence framework (example:
hibernate) that generate most of the SQL.

Reading SQL from properties file similar to i18n would
be possible, but I think it would be very confusing
for maintenance.

Arne
.