>From: Dimitri PISSARENKO <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: [EMAIL PROTECTED]
>Subject: [JBoss-user] Database queries
>Date: Sat, 13 Jul 2002 14:43:42 +0200
>
>Hello!
>
>In my application I have a lot of SQL queries to the database. I want
>to implement them in a way, which in future should allow an easy
>migration to another database (I'm using bean-managed-persistence).
>
>One of the problems of database migration are slight differences in
>the syntax of SQL queries at different DBMS.
>
>Now I have a special class for each query, so instead of writing
>
>
>
>Statement statement = conn.createStatement();
>statement.executeUpdate("DELETE FROM tbl_project WHERE ID=" + 1);
>
>
>I write
>
>Statement statement = conn.createStatement();
>ProjectDeletionQuery query = new ProjectDeletionQuery(1);
>statement.executeUpdate(query.toString());
>
>
>
>where ProjectDeletionQuery is defined as
>
>
>
>public class ProjectDeletionQuery
>{
>public ProjectDeletionQuery(int pk)
>{
>this.primaryKey = pk;
>}
>public String toString()
>{
>return "DELETE FROM tbl_project WHERE ID=" + this.primaryKey;
>}
>
>private int primaryKey;
>}
>
>
>
>I would like to know whether there are more elegant ways to separate
>SQL query syntax from the code (perhaps a special Java library or a
>tool).
>
>Thanks in advance
>
>Dimitri Pissarenko
>
>
>-------------------------------------------------------
>This sf.net email is sponsored by:ThinkGeek
>Welcome to geek heaven.
>http://thinkgeek.com/sf
>_______________________________________________
>JBoss-user mailing list
>[EMAIL PROTECTED]
>https://lists.sourceforge.net/lists/listinfo/jboss-user
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user