RE: generic SQL implementation
Look at OJB to take care of everything for you with object/dao management. You can do a ReportByQuery with OJB that allows you to do what you are describing. -Original Message- From: Vinay [mailto:[EMAIL PROTECTED] Sent: Monday, July 07, 2003 10:09 AM To: Struts Users Mailing List Subject: generic SQL implementation 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 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: generic SQL implementation
There is a Mapper project in the commons sandbox that might help you. It allows you to store SQL in a properties file to remove it from your code. Also, it acts as a layer between your app and your persistence technology so you can swap in an O/R mapping tool, EJBs, etc if you decide against using JDBC in the future. It also, makes using JDBC a breeze and removes much error prone and repetitive code from your app. David --- Vinay [EMAIL PROTECTED] wrote: 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 __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: generic SQL implementation
David, Can you give me the URL for the mapper, this might be the one I am looking for ,even though I wanted to implement the API on my own. Thanks a lot VInay - Original Message - From: David Graham [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, July 07, 2003 11:35 AM Subject: Re: generic SQL implementation There is a Mapper project in the commons sandbox that might help you. It allows you to store SQL in a properties file to remove it from your code. Also, it acts as a layer between your app and your persistence technology so you can swap in an O/R mapping tool, EJBs, etc if you decide against using JDBC in the future. It also, makes using JDBC a breeze and removes much error prone and repetitive code from your app. David --- Vinay [EMAIL PROTECTED] wrote: 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 __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: generic SQL implementation
I use torque and IMHO combined with struts , it slides through the molecules of wetness like an eel through sea weed .. http://db.apache.org/torque A chap called Ville who posted this group a few weeks ago sent me some notes where he spent a week of so gathering sources of info on how to get torque and struts running together (Thanks Ville) . If you want them just mail me.. cheers mark On Monday, July 7, 2003, at 04:08 PM, Vinay wrote: 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 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: generic SQL implementation
Mapper doesn't have a real website yet but you can view the source online at: http://cvs.apache.org/viewcvs.cgi/jakarta-commons-sandbox/mapper/ You could also check it out of the cvs repository. David --- Vinay [EMAIL PROTECTED] wrote: David, Can you give me the URL for the mapper, this might be the one I am looking for ,even though I wanted to implement the API on my own. Thanks a lot VInay - Original Message - From: David Graham [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, July 07, 2003 11:35 AM Subject: Re: generic SQL implementation There is a Mapper project in the commons sandbox that might help you. It allows you to store SQL in a properties file to remove it from your code. Also, it acts as a layer between your app and your persistence technology so you can swap in an O/R mapping tool, EJBs, etc if you decide against using JDBC in the future. It also, makes using JDBC a breeze and removes much error prone and repetitive code from your app. David --- Vinay [EMAIL PROTECTED] wrote: 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 __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: generic SQL implementation
I don't quite understand the data access part of the Mapper project. How do you initialize a new Jdbc connection? Shouldn't there be a JdbcFactory class similar to MapperFactory class, where you could pass the connection properties? + public JdbcFactoryTest(String, java.util.Properties) { + } similar to the following test: public MapperFactoryTest(String name) { super(name); this.mappers.put(testMapper, org.apache.commons.mapper.TestMapper); this.mappers.put( java.util.ArrayList, org.apache.commons.mapper.TestMapper); } -Original Message- From: David Graham [mailto:[EMAIL PROTECTED] Sent: July 7, 2003 10:24 AM To: Struts Users Mailing List Subject: Re: generic SQL implementation Mapper doesn't have a real website yet but you can view the source online at: http://cvs.apache.org/viewcvs.cgi/jakarta-commons-sandbox/mapper/ You could also check it out of the cvs repository. David --- Vinay [EMAIL PROTECTED] wrote: David, Can you give me the URL for the mapper, this might be the one I am looking for ,even though I wanted to implement the API on my own. Thanks a lot VInay - Original Message - From: David Graham [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, July 07, 2003 11:35 AM Subject: Re: generic SQL implementation There is a Mapper project in the commons sandbox that might help you. It allows you to store SQL in a properties file to remove it from your code. Also, it acts as a layer between your app and your persistence technology so you can swap in an O/R mapping tool, EJBs, etc if you decide against using JDBC in the future. It also, makes using JDBC a breeze and removes much error prone and repetitive code from your app. David --- Vinay [EMAIL PROTECTED] wrote: 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 __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: generic SQL implementation
This question is better suited for the commons-user mailing list. Here's a typical JDBC usage: Map mappers = new HashMap(); mappers.put(testMapper,org.apache.commons.mapper.TestMapper); MapperFactory factory = new MapperFactory(mappers); DataSource ds = // get DataSource here JdbcMapperFactoryListener jdbcListener = new JdbcMapperFactoryListener(ds); factory.addMapperFactoryListener(jdbcListener); // All code up to this point would be done once at app. startup, this code // would be run when you want to persist a new object Mapper mapper = factory.getMapper(testMapper); mapper.create(persistThisObject); David --- Yansheng Lin [EMAIL PROTECTED] wrote: I don't quite understand the data access part of the Mapper project. How do you initialize a new Jdbc connection? Shouldn't there be a JdbcFactory class similar to MapperFactory class, where you could pass the connection properties? + public JdbcFactoryTest(String, java.util.Properties) { + } similar to the following test: public MapperFactoryTest(String name) { super(name); this.mappers.put(testMapper, org.apache.commons.mapper.TestMapper); this.mappers.put( java.util.ArrayList, org.apache.commons.mapper.TestMapper); } -Original Message- From: David Graham [mailto:[EMAIL PROTECTED] Sent: July 7, 2003 10:24 AM To: Struts Users Mailing List Subject: Re: generic SQL implementation Mapper doesn't have a real website yet but you can view the source online at: http://cvs.apache.org/viewcvs.cgi/jakarta-commons-sandbox/mapper/ You could also check it out of the cvs repository. David --- Vinay [EMAIL PROTECTED] wrote: David, Can you give me the URL for the mapper, this might be the one I am looking for ,even though I wanted to implement the API on my own. Thanks a lot VInay - Original Message - From: David Graham [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, July 07, 2003 11:35 AM Subject: Re: generic SQL implementation There is a Mapper project in the commons sandbox that might help you. It allows you to store SQL in a properties file to remove it from your code. Also, it acts as a layer between your app and your persistence technology so you can swap in an O/R mapping tool, EJBs, etc if you decide against using JDBC in the future. It also, makes using JDBC a breeze and removes much error prone and repetitive code from your app. David --- Vinay [EMAIL PROTECTED] wrote: 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 __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]