struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Taylor" <>
Subject RE: [OT]: Generic Query Language implementations
Date Mon, 28 Apr 2003 21:31:20 GMT
I thought that the DAO pattern was a solution for the exact
problem you describe. You have a factory which returns the
appropriate DAO implementation according to some logic it
performs. Maybe your factory doesn't necessarily return
different concrete implementations, but as David alluded to,
returns the same implementations but with the appropriate
db specific query syntax stored on disk and retrieved at
run time or init time.

Currently my set up isn't quite as complex as yours as I
only hit one db, but I have my queries defined as static
final constants in the DAO implementations. Some of them
are quite complex and I have thought
about "moving" them to an XML file where they could be
read into memory when my app initialized. The DAO would then
reference each SQL statement by a unique name. This would allow
me to modify them without rebuilding the code.


-----Original Message-----
From: Vinay []
Sent: Monday, April 28, 2003 5:03 PM
To: Struts Users Mailing List
Subject: Re: [OT]: Generic Query Language implementations

Is it not going to be very complicated if we use property file as there will
be lot of query types, conditions, AND's ,OR' s etc

----- Original Message -----
From: "David Graham" <>
To: <>
Sent: Monday, April 28, 2003 4:42 PM
Subject: Re: [OT]: Generic Query Language implementations

> A *much* simpler solution is to put your SQL in a properties file for each
> database and load the appropriate file depending on which database you're
> using at runtime.
> David
> >From: "Vinay" <>
> >Reply-To: "Struts Users Mailing List" <>
> >To: "Struts Users Mailing List" <>
> >Subject: [OT]: Generic Query Language implementations
> >Date: Mon, 28 Apr 2003 16:28:46 -0400
> >
> >Has anybody implemented a generic implementation for querying databases
> >during runtime. I am  using  DAO's for data access layer. But I want to
> >furthur move the database logic to down one more layer of abstraction.I
> >dealing with different kinds of database (eg. let's say a MySQL, MS
> >and another not SQL at all ,index sequential files). I want the DAO to
> >access the database during runtime. So I want my DAO to be independent of
> >the SQL statements.The Database Interfrace would talk to either MySQL,or
> >Oracle or any other database.So that  there is no  need to have  DAO for
> >each database syntax, rather , this should be handled by a API thru an
> >interface.
> >
> >Here's and examples
> >
> >Let's say for select statement , we supply table name, column names,
> >cluase , and's etc
> >
> >The following method should handle the query
> >
> >List getSelect(String tablename, List columnnames, List Orderby,.....)
> >{
> >
> >
> >return queryresult
> >}
> >
> >
> >Any ideas appreciated
> >Thank you
> >Vinay
> _________________________________________________________________
> Help STOP SPAM with the new MSN 8 and get 2 months FREE*
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message