struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Taylor" <rtay...@mulework.com>
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.


robert

-----Original Message-----
From: Vinay [mailto:vinay@mdp.net]
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" <dgraham1980@hotmail.com>
To: <struts-user@jakarta.apache.org>
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" <vinay@mdp.net>
> >Reply-To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
> >To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
> >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
am
> >dealing with different kinds of database (eg. let's say a MySQL, MS
Access
> >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,
where
> >cluase , and's etc
> >
> >The following method should handle the query
> >
> >List getSelect(String tablename, List columnnames, List Orderby,.....)
etc
> >{
> >
> >
> >return queryresult
> >}
> >
> >
> >Any ideas appreciated
> >Thank you
> >Vinay
>
>
> _________________________________________________________________
> Help STOP SPAM with the new MSN 8 and get 2 months FREE*
> http://join.msn.com/?page=features/junkmail
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message