Re: Where to store SQL statement
- From: Arne Vajhøj <arne@xxxxxxxxxx>
- Date: Wed, 09 May 2007 21:49:14 -0400
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
.
- References:
- Where to store SQL statement
- From: jsguru72
- Where to store SQL statement
- Prev by Date: Where to store SQL statement
- Next by Date: Re: Where to store SQL statement
- Previous by thread: Where to store SQL statement
- Next by thread: Re: Where to store SQL statement
- Index(es):