  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Tomcat - JSP/Servlet container | | Struts - A MVC web framework | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | JSP - A mailing list about Java Server Pages specification and reference | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | |
Struts & Hibernate
|
|
|
  | | | Separating SQL from code | Separating SQL from code 2004-04-07 - By Umesh Singh
Back Hi You can use DAO with Properties file to keep the SQL configurable. We are using SQL as Private String at class level in the DAO. You can use this approach also so it is manageable.
Regards, Umesh
-- --Original Message-- -- From: Jean-Christian Imbeault [mailto:jean-christian.imbeault@(protected)] Sent: 07 April 2004 10:26 To: J2EEPATTERNS-INTEREST@(protected) Subject: Separating SQL from code
Hi, I'm somewhat new to patterns and J2EE but I was wondering if someone could help with a question I have.
I'm wondering if there are any patterns of practices that document ways to extract SQL from code or that discuss if this is a good thing or not?
I have read the J2EE Patterns book and done a bit of research (especially on DAO) but can find anything that talks about a total separation of SQL from code. I am wondering is removing SQL from code (and possibly placing it in a properties file or such) might be a good way of putting all the SQL in one place to make changes (maintenance) easier.
The best I could find was this article which documents one approach but not the pros or cons:
http://www.javapractices.com/Topic105.cjp
Thanks!
Jean-Christian Imbeault
==================================================================== Companion Site: http://www.corej2eepatterns.com J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)
==================================================================== Companion Site: http://www.corej2eepatterns.com J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859 (See http://iso-8859.ora-code.com)-1"> <META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12"> <TITLE>RE: Separating SQL from code</TITLE> </HEAD> <BODY>
<P><FONT SIZE=2>Hi You can use DAO with Properties file to keep the SQL configurable. We are using SQL as Private String at class level in the DAO. You can use this approach also so it is manageable.</FONT></P>
<P><FONT SIZE=2>Regards,</FONT> <BR><FONT SIZE=2>Umesh</FONT> </P>
<P><FONT SIZE=2>-- --Original Message-- --</FONT> <BR><FONT SIZE=2>From: Jean-Christian Imbeault</FONT> <BR><FONT SIZE=2>[<A HREF="mailto:jean-christian.imbeault@(protected)">mailto :jean-christian.imbeault@(protected)</A>]</FONT> <BR><FONT SIZE=2>Sent: 07 April 2004 10:26</FONT> <BR><FONT SIZE=2>To: J2EEPATTERNS-INTEREST@(protected)</FONT> <BR><FONT SIZE=2>Subject: Separating SQL from code</FONT> </P> <BR>
<P><FONT SIZE=2>Hi, I'm somewhat new to patterns and J2EE but I was wondering if someone</FONT> <BR><FONT SIZE=2>could help with a question I have.</FONT> </P>
<P><FONT SIZE=2>I'm wondering if there are any patterns of practices that document ways to</FONT> <BR><FONT SIZE=2>extract SQL from code or that discuss if this is a good thing or not?</FONT> </P>
<P><FONT SIZE=2>I have read the J2EE Patterns book and done a bit of research (especially on</FONT> <BR><FONT SIZE=2>DAO) but can find anything that talks about a total separation of SQL from</FONT> <BR><FONT SIZE=2>code. I am wondering is removing SQL from code (and possibly placing it in a</FONT> <BR><FONT SIZE=2>properties file or such) might be a good way of putting all the SQL in one</FONT> <BR><FONT SIZE=2>place to make changes (maintenance) easier.</FONT> </P>
<P><FONT SIZE=2>The best I could find was this article which documents one approach but not</FONT> <BR><FONT SIZE=2>the pros or cons:</FONT> </P>
<P><FONT SIZE=2><A HREF="http://www.javapractices.com/Topic105.cjp" TARGET=" _blank">http://www.javapractices.com/Topic105.cjp</A></FONT> </P>
<P><FONT SIZE=2>Thanks!</FONT> </P>
<P><FONT SIZE=2>Jean-Christian Imbeault</FONT> </P>
<P><FONT SIZE=2>=============================================================== =====</FONT> <BR><FONT SIZE=2>Companion Site: <A HREF="http://www.corej2eepatterns.com" TARGET="_blank">http://www.corej2eepatterns.com</A></FONT> <BR><FONT SIZE=2>J2EE BluePrints: <A HREF="http://java.sun.com/blueprints /corej2eepatterns" TARGET="_blank">http://java.sun.com/blueprints /corej2eepatterns</A></FONT> <BR><FONT SIZE=2>List Archive: <A HREF="http://archives.java.sun.com/archives /j2eepatterns-interest.html" TARGET="_blank">http://archives.java.sun.com /archives/j2eepatterns-interest.html</A></FONT> <BR><FONT SIZE=2>Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)</FONT> </P>
</BODY> </HTML> ==================================================================== Companion Site: http://www.corej2eepatterns.com J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)
|
|
 |