Hello there,
        I am doing a similar thing following an article that appeared on
javaWorld (that's about XML and  JDBC)

http://www.javaworld.com/javaworld/jw-11-2000/jw-1110-xmlreflection.html


I am not actually using 'variables' like you plan to use ($id, $name). I
am instead following another article (JavaWorld again ) for populating
statements automatically 
http://www.javaworld.com/javaworld/jw-05-2002/jw-0524-sql.html


in the big picture, I have a DAOFactory which creates (and caches) a set
of DAOs.  Each DAO Is initialized with a class (usually a DTO) that
should be populated with JDBC columns.
The ResultProcessor (following the second article) uses reflection and
the 
Map of fields mentioned above to populate the DTO.

If you take ideas from first and second article, I am sure you can come
out
With something (like I did).
Final piece, I am using digester to parse the XML file..


I am not aware of any APIs that allows you to write queries thru an
XML file.... 
Hibernate lets you write SQL queries in hibernate-cfg.xml, have a look..

www.hibernate.org

hope this helps

regards
        marco





-----Original Message-----
From: Shailender Jain [mailto:[EMAIL PROTECTED] 
Sent: 07 July 2004 04:48
To: [EMAIL PROTECTED]
Subject: EXTERNALIZE SQL QUERIES

Hi,

I am using struts framework for the development of my application.
I want to externalize the  sql queries written in my application to an
xml file.

For e.g. if i have got a query
insert into employee (id, name) values (1, 'shailender');

This should be written in xml as
insert into employee (id, name) values ($id, $name);

Where id and name are variables in the application of type int and
string.

Also if the id and name are arrays then it should insert all the values.

Is there any api available for doing this without putting much effort in
learning the api.



Regards
Shailender Jain


---------------------------------------------------------------------
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]

Reply via email to