You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ashish Kulkarni <ku...@yahoo.com> on 2004/10/27 19:02:26 UTC

[OT] SQL in XML file

Hi
Is there any code out there or any one worked on a
framework, where we can define SQL statements in XML
file and at runtime java program will read this XML
file, build the SQL if prepared statement and execute
it and return a ResultSet

What may be the points to be taken into consideration
if i have to write a new one
Ashish


		
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 

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


Re: [OT] SQL in XML file

Posted by Thompson Marzagao <th...@nettheory.com>.
It's not exacly what you're looking for, as it's meant for testing, but 
you might want to take a look at DBUnit. At least you can look at the 
source code:

"DbUnit has the ability to export and import your database data to and 
from XML datasets"
http://dbunit.sourceforge.net/

Thompson

Ashish Kulkarni wrote:

>Hi
>Is there any code out there or any one worked on a
>framework, where we can define SQL statements in XML
>file and at runtime java program will read this XML
>file, build the SQL if prepared statement and execute
>it and return a ResultSet
>
>What may be the points to be taken into consideration
>if i have to write a new one
>Ashish
>
>
>		
>__________________________________
>Do you Yahoo!?
>Yahoo! Mail Address AutoComplete - You start. We finish.
>http://promotions.yahoo.com/new_mail 
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>
>
>
>  
>



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


Re: [OT] SQL in XML file

Posted by Bent André Solheim <be...@gmail.com>.
Hi Ashis,

If you are looking for a way to roll your own on this one, I would
recommend that you look at the commons-digester for reading the XML
file - it's really nice for this kind of work, and check out Dr. Heinz
Kabutz' Tutorial on self reloading XML property files
(http://www.javaspecialists.co.za/archive/Issue095.html).

Hope this helps.

Best Regards
Bent


On Thu, 28 Oct 2004 18:53:57 -0400, David G. Friedman
<hu...@ix.netcom.com> wrote:
> Marco,
> 
> You are incorrect in saying Hibernate needs one hbm.xml file per class.  You
> can put all of your class definitions and named queries in one
> SOMETHING.hbml.xml file.  This is in the documentation, see the cats and
> dogs example, section 5.1.2.  I do it myself.  You would just need one XML
> file for the connection information and one XML file to contain your class
> definitions and named (or parameterized) queries which is used at
> configuration initialization.  I did it that way until I started using the
> XDoclet Eclipse plug-in (JBossIDE actually).
> 
> 
> 
> Regards,
> David
> 
> -----Original Message-----
> From: Marco Mistroni [mailto:mmistroni@waersystems.com]
> Sent: Thursday, October 28, 2004 4:29 AM
> To: 'Struts Users Mailing List'; 'Peng Tuck Kwok'
> Subject: RE: [OT] SQL in XML file
> 
> Hello,
> >I don't think hibernate does sql in a xml file.... .
> >I think it's more of a mapping of objects.
> 
> Not in own xml file... but if you have the  YourHIbClass.hbm.xml, you
> can put your sql 'queries'  in there..
> Of course, that's only for a specific class.... every class that you use
> Will need to have its own hbm.xml file, so your sqls will be 'scattered'
> Throughout all classes..
> 
> 2 cents again :-)
> 
> Regards
>        marco
> 
> >Ashish, you are probably looking for a ORM right ?  You could look at
> >hibernate,
> >Cayenne  and there's one from apache as well.
> 
> On Thu, 28 Oct 2004 08:41:15 +0100, Marco Mistroni
> <mm...@waersystems.com> wrote:
> > Hello
> >         Hibernate does something like that, you may want to
> > Have a look at it..
> > Alternatively, I have done a similar thing for my own webapp,
> > Where I have  a 'persistence layer' that reads an xml config
> > File where I list all sql statements and mapping between
> > Columns and DTO fields (I user reflections for populating DTOs..)
> > I am using digester to build a Map out of the XML..
> > Not so difficult, however if there is a tool that does it
> > For you (Hibernate for example), it will save you time :-)
> >
> > My 2 cents...
> >
> > Regards
> >         marco
> >
> > -----Original Message-----
> > From: Ashish Kulkarni [mailto:kulkarni_ash1312@yahoo.com]
> > Sent: 27 October 2004 18:02
> > To: user@struts.apache.org
> > Subject: [OT] SQL in XML file
> >
> > Hi
> > Is there any code out there or any one worked on a
> > framework, where we can define SQL statements in XML
> > file and at runtime java program will read this XML
> > file, build the SQL if prepared statement and execute
> > it and return a ResultSet
> >
> > What may be the points to be taken into consideration
> > if i have to write a new one
> > Ashish
> >
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Mail Address AutoComplete - You start. We finish.
> > http://promotions.yahoo.com/new_mail
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

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


RE: [OT] SQL in XML file

Posted by "David G. Friedman" <hu...@ix.netcom.com>.
Marco,

You are incorrect in saying Hibernate needs one hbm.xml file per class.  You
can put all of your class definitions and named queries in one
SOMETHING.hbml.xml file.  This is in the documentation, see the cats and
dogs example, section 5.1.2.  I do it myself.  You would just need one XML
file for the connection information and one XML file to contain your class
definitions and named (or parameterized) queries which is used at
configuration initialization.  I did it that way until I started using the
XDoclet Eclipse plug-in (JBossIDE actually).

Regards,
David

-----Original Message-----
From: Marco Mistroni [mailto:mmistroni@waersystems.com]
Sent: Thursday, October 28, 2004 4:29 AM
To: 'Struts Users Mailing List'; 'Peng Tuck Kwok'
Subject: RE: [OT] SQL in XML file


Hello,
>I don't think hibernate does sql in a xml file.... .
>I think it's more of a mapping of objects.

Not in own xml file... but if you have the  YourHIbClass.hbm.xml, you
can put your sql 'queries'  in there..
Of course, that's only for a specific class.... every class that you use
Will need to have its own hbm.xml file, so your sqls will be 'scattered'
Throughout all classes..

2 cents again :-)

Regards
	marco



>Ashish, you are probably looking for a ORM right ?  You could look at
>hibernate,
>Cayenne  and there's one from apache as well.


On Thu, 28 Oct 2004 08:41:15 +0100, Marco Mistroni
<mm...@waersystems.com> wrote:
> Hello
>         Hibernate does something like that, you may want to
> Have a look at it..
> Alternatively, I have done a similar thing for my own webapp,
> Where I have  a 'persistence layer' that reads an xml config
> File where I list all sql statements and mapping between
> Columns and DTO fields (I user reflections for populating DTOs..)
> I am using digester to build a Map out of the XML..
> Not so difficult, however if there is a tool that does it
> For you (Hibernate for example), it will save you time :-)
>
> My 2 cents...
>
> Regards
>         marco
>
> -----Original Message-----
> From: Ashish Kulkarni [mailto:kulkarni_ash1312@yahoo.com]
> Sent: 27 October 2004 18:02
> To: user@struts.apache.org
> Subject: [OT] SQL in XML file
>
> Hi
> Is there any code out there or any one worked on a
> framework, where we can define SQL statements in XML
> file and at runtime java program will read this XML
> file, build the SQL if prepared statement and execute
> it and return a ResultSet
>
> What may be the points to be taken into consideration
> if i have to write a new one
> Ashish
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail Address AutoComplete - You start. We finish.
> http://promotions.yahoo.com/new_mail
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


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


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


RE: [OT] SQL in XML file

Posted by Marco Mistroni <mm...@waersystems.com>.
Hello,
>I don't think hibernate does sql in a xml file.... . 
>I think it's more of a mapping of objects. 

Not in own xml file... but if you have the  YourHIbClass.hbm.xml, you
can put your sql 'queries'  in there..
Of course, that's only for a specific class.... every class that you use
Will need to have its own hbm.xml file, so your sqls will be 'scattered'
Throughout all classes..

2 cents again :-)

Regards
	marco



>Ashish, you are probably looking for a ORM right ?  You could look at
>hibernate,
>Cayenne  and there's one from apache as well.  


On Thu, 28 Oct 2004 08:41:15 +0100, Marco Mistroni
<mm...@waersystems.com> wrote:
> Hello
>         Hibernate does something like that, you may want to
> Have a look at it..
> Alternatively, I have done a similar thing for my own webapp,
> Where I have  a 'persistence layer' that reads an xml config
> File where I list all sql statements and mapping between
> Columns and DTO fields (I user reflections for populating DTOs..)
> I am using digester to build a Map out of the XML..
> Not so difficult, however if there is a tool that does it
> For you (Hibernate for example), it will save you time :-)
> 
> My 2 cents...
> 
> Regards
>         marco
> 
> -----Original Message-----
> From: Ashish Kulkarni [mailto:kulkarni_ash1312@yahoo.com]
> Sent: 27 October 2004 18:02
> To: user@struts.apache.org
> Subject: [OT] SQL in XML file
> 
> Hi
> Is there any code out there or any one worked on a
> framework, where we can define SQL statements in XML
> file and at runtime java program will read this XML
> file, build the SQL if prepared statement and execute
> it and return a ResultSet
> 
> What may be the points to be taken into consideration
> if i have to write a new one
> Ashish
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail Address AutoComplete - You start. We finish.
> http://promotions.yahoo.com/new_mail
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

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


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


Re: [OT] SQL in XML file

Posted by Peng Tuck Kwok <pe...@gmail.com>.
I don't think hibernate does sql in a xml file.... . 
I think it's more of a mapping of objects. 

Ashish, you are probably looking for a ORM right ?  You could look at
hibernate,
Cayenne  and there's one from apache as well.  


On Thu, 28 Oct 2004 08:41:15 +0100, Marco Mistroni
<mm...@waersystems.com> wrote:
> Hello
>         Hibernate does something like that, you may want to
> Have a look at it..
> Alternatively, I have done a similar thing for my own webapp,
> Where I have  a 'persistence layer' that reads an xml config
> File where I list all sql statements and mapping between
> Columns and DTO fields (I user reflections for populating DTOs..)
> I am using digester to build a Map out of the XML..
> Not so difficult, however if there is a tool that does it
> For you (Hibernate for example), it will save you time :-)
> 
> My 2 cents...
> 
> Regards
>         marco
> 
> -----Original Message-----
> From: Ashish Kulkarni [mailto:kulkarni_ash1312@yahoo.com]
> Sent: 27 October 2004 18:02
> To: user@struts.apache.org
> Subject: [OT] SQL in XML file
> 
> Hi
> Is there any code out there or any one worked on a
> framework, where we can define SQL statements in XML
> file and at runtime java program will read this XML
> file, build the SQL if prepared statement and execute
> it and return a ResultSet
> 
> What may be the points to be taken into consideration
> if i have to write a new one
> Ashish
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail Address AutoComplete - You start. We finish.
> http://promotions.yahoo.com/new_mail
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

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


RE: [OT] SQL in XML file

Posted by Ashish Kulkarni <ku...@yahoo.com>.
Hi
I dont do any thing that complemenated, this is what i
had in mind my xml file will look some thing like this
<xml>
<sql>Select * from ABC
<parm type="java.lang.String">myfied</parm>
</sql>
Then my java program will read this XML file and build
a preparedStatement like
pstmtSQl = SELECT * from ABC where myfield=?
the build the preparedStatement and execute the querry
and return resultset,
So in future i can change my SQL to be
<xml>
<sql>Select myfield,myfield2 from ABC
<parm type="java.lang.String">myfied</parm>
</sql>
without having to change my code or compile it
I think i will look into iBatis to see if i can use it
Regards
Ashish

--- "David G. Friedman" <hu...@ix.netcom.com> wrote:

> Ashish,
> 
> I've never heard of a data layer that looks
> proactively at a configuration
> file.  However, you could make your ClassB check the
> timestamp of the
> configuration file and reload it if it changed since
> the last time you
> looked at it (if you store the modification
> timestamp or something like
> that).
> 
> If you want to do that with Hibernate, I recommend
> you keep your database
> connections pooled in a data source that you hand
> over to Hibernate when you
> rebuild the configuration.  If you let Hibernate
> setup the connection
> pooling, whenever you reload the configuration, it
> would close and reopen
> the database connections, probably wasting your
> time.  If the pool of
> database connections is separate, you can pass that
> pool to Hibernate so
> hibernate skips that step and never closes the pool.
>  You would just have to
> code pool setup at application initialization and
> pool destruction at
> application shutdown.  Then rebuild your hibernate
> configuration in ClassB
> whenever you detect your XML file changing.
> 
> The same thing could happen in a webapp without
> having to restart the
> webapp.  I'd recommend reading the Hibernate
> reference PDF and searching on
> "Configuration()".  I see it as Chapter 3.1 in my
> Hibernate(.org) v2.1.6
> documentation.
> 
> Regards,
> David
> 
> -----Original Message-----
> From: Ashish Kulkarni
> [mailto:kulkarni_ash1312@yahoo.com]
> Sent: Wednesday, October 27, 2004 1:58 PM
> To: Struts Users Mailing List
> Subject: RE: [OT] SQL in XML file
> 
> 
> Hi
> This is what i want to achieve by keeping the SQL
> statement outside java code,
> I can change the SQL statement with out having to
> compile the java program.
> The resltset will be returned to another java
> program
> So ClassA calls ClassB, ClassB reads my.xml file,
> which has a SQL statement, ClassB will execute it
> and
> return resultset to ClassA
> 
> Ashish
> --- "David G. Friedman" <hu...@ix.netcom.com>
> wrote:
> 
> > Ashish,
> >
> > Where do you want your resultSet returned?  You
> can
> > use Hibernate(.org) in a
> > webapp or stand-alone (even command line) program.
> > It uses XML
> > configuration files.  If you're looking to start
> the
> > data layer and have it
> > run a prepared statement to put into memory for
> > later use, you could do that
> > as well.  If you did that in Struts, I'd suggest
> > using the Hibernate plugIn
> > then add something at the end of the Init() method
> > so it loads your query
> > and stores the results in the application scope
> for
> > all visitors to access.
> > Hibernate supports named queries with and without
> > parameters.
> >
> > Regards,
> > David
> >
> > -----Original Message-----
> > From: Ashish Kulkarni
> > [mailto:kulkarni_ash1312@yahoo.com]
> > Sent: Wednesday, October 27, 2004 1:02 PM
> > To: user@struts.apache.org
> > Subject: [OT] SQL in XML file
> >
> >
> > Hi
> > Is there any code out there or any one worked on a
> > framework, where we can define SQL statements in
> XML
> > file and at runtime java program will read this
> XML
> > file, build the SQL if prepared statement and
> > execute
> > it and return a ResultSet
> >
> > What may be the points to be taken into
> > consideration
> > if i have to write a new one
> > Ashish
> >
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Mail Address AutoComplete - You start. We
> > finish.
> > http://promotions.yahoo.com/new_mail
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > user-unsubscribe@struts.apache.org
> > For additional commands, e-mail:
> > user-help@struts.apache.org
> >
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > user-unsubscribe@struts.apache.org
> > For additional commands, e-mail:
> > user-help@struts.apache.org
> >
> >
> 
> 
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail Address AutoComplete - You start. We
> finish.
> http://promotions.yahoo.com/new_mail
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 
> 


=====
A$HI$H


		
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 

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


RE: [OT] SQL in XML file

Posted by "David G. Friedman" <hu...@ix.netcom.com>.
Ashish,

I've never heard of a data layer that looks proactively at a configuration
file.  However, you could make your ClassB check the timestamp of the
configuration file and reload it if it changed since the last time you
looked at it (if you store the modification timestamp or something like
that).

If you want to do that with Hibernate, I recommend you keep your database
connections pooled in a data source that you hand over to Hibernate when you
rebuild the configuration.  If you let Hibernate setup the connection
pooling, whenever you reload the configuration, it would close and reopen
the database connections, probably wasting your time.  If the pool of
database connections is separate, you can pass that pool to Hibernate so
hibernate skips that step and never closes the pool.  You would just have to
code pool setup at application initialization and pool destruction at
application shutdown.  Then rebuild your hibernate configuration in ClassB
whenever you detect your XML file changing.

The same thing could happen in a webapp without having to restart the
webapp.  I'd recommend reading the Hibernate reference PDF and searching on
"Configuration()".  I see it as Chapter 3.1 in my Hibernate(.org) v2.1.6
documentation.

Regards,
David

-----Original Message-----
From: Ashish Kulkarni [mailto:kulkarni_ash1312@yahoo.com]
Sent: Wednesday, October 27, 2004 1:58 PM
To: Struts Users Mailing List
Subject: RE: [OT] SQL in XML file


Hi
This is what i want to achieve by keeping the SQL
statement outside java code,
I can change the SQL statement with out having to
compile the java program.
The resltset will be returned to another java program
So ClassA calls ClassB, ClassB reads my.xml file,
which has a SQL statement, ClassB will execute it and
return resultset to ClassA

Ashish
--- "David G. Friedman" <hu...@ix.netcom.com> wrote:

> Ashish,
>
> Where do you want your resultSet returned?  You can
> use Hibernate(.org) in a
> webapp or stand-alone (even command line) program.
> It uses XML
> configuration files.  If you're looking to start the
> data layer and have it
> run a prepared statement to put into memory for
> later use, you could do that
> as well.  If you did that in Struts, I'd suggest
> using the Hibernate plugIn
> then add something at the end of the Init() method
> so it loads your query
> and stores the results in the application scope for
> all visitors to access.
> Hibernate supports named queries with and without
> parameters.
>
> Regards,
> David
>
> -----Original Message-----
> From: Ashish Kulkarni
> [mailto:kulkarni_ash1312@yahoo.com]
> Sent: Wednesday, October 27, 2004 1:02 PM
> To: user@struts.apache.org
> Subject: [OT] SQL in XML file
>
>
> Hi
> Is there any code out there or any one worked on a
> framework, where we can define SQL statements in XML
> file and at runtime java program will read this XML
> file, build the SQL if prepared statement and
> execute
> it and return a ResultSet
>
> What may be the points to be taken into
> consideration
> if i have to write a new one
> Ashish
>
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail Address AutoComplete - You start. We
> finish.
> http://promotions.yahoo.com/new_mail
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
>
>




__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail

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


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


RE: [OT] SQL in XML file

Posted by Ashish Kulkarni <ku...@yahoo.com>.
Hi
This is what i want to achieve by keeping the SQL
statement outside java code, 
I can change the SQL statement with out having to
compile the java program.
The resltset will be returned to another java program 
So ClassA calls ClassB, ClassB reads my.xml file,
which has a SQL statement, ClassB will execute it and
return resultset to ClassA

Ashish
--- "David G. Friedman" <hu...@ix.netcom.com> wrote:

> Ashish,
> 
> Where do you want your resultSet returned?  You can
> use Hibernate(.org) in a
> webapp or stand-alone (even command line) program. 
> It uses XML
> configuration files.  If you're looking to start the
> data layer and have it
> run a prepared statement to put into memory for
> later use, you could do that
> as well.  If you did that in Struts, I'd suggest
> using the Hibernate plugIn
> then add something at the end of the Init() method
> so it loads your query
> and stores the results in the application scope for
> all visitors to access.
> Hibernate supports named queries with and without
> parameters.
> 
> Regards,
> David
> 
> -----Original Message-----
> From: Ashish Kulkarni
> [mailto:kulkarni_ash1312@yahoo.com]
> Sent: Wednesday, October 27, 2004 1:02 PM
> To: user@struts.apache.org
> Subject: [OT] SQL in XML file
> 
> 
> Hi
> Is there any code out there or any one worked on a
> framework, where we can define SQL statements in XML
> file and at runtime java program will read this XML
> file, build the SQL if prepared statement and
> execute
> it and return a ResultSet
> 
> What may be the points to be taken into
> consideration
> if i have to write a new one
> Ashish
> 
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail Address AutoComplete - You start. We
> finish.
> http://promotions.yahoo.com/new_mail
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 
> 



		
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 

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


RE: [OT] SQL in XML file

Posted by "David G. Friedman" <hu...@ix.netcom.com>.
Ashish,

Where do you want your resultSet returned?  You can use Hibernate(.org) in a
webapp or stand-alone (even command line) program.  It uses XML
configuration files.  If you're looking to start the data layer and have it
run a prepared statement to put into memory for later use, you could do that
as well.  If you did that in Struts, I'd suggest using the Hibernate plugIn
then add something at the end of the Init() method so it loads your query
and stores the results in the application scope for all visitors to access.
Hibernate supports named queries with and without parameters.

Regards,
David

-----Original Message-----
From: Ashish Kulkarni [mailto:kulkarni_ash1312@yahoo.com]
Sent: Wednesday, October 27, 2004 1:02 PM
To: user@struts.apache.org
Subject: [OT] SQL in XML file


Hi
Is there any code out there or any one worked on a
framework, where we can define SQL statements in XML
file and at runtime java program will read this XML
file, build the SQL if prepared statement and execute
it and return a ResultSet

What may be the points to be taken into consideration
if i have to write a new one
Ashish



__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail

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


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


RE: [OT] SQL in XML file

Posted by Robert Taylor <rt...@mulework.com>.
Look at iBatis.

robert

> -----Original Message-----
> From: Ashish Kulkarni [mailto:kulkarni_ash1312@yahoo.com]
> Sent: Wednesday, October 27, 2004 1:02 PM
> To: user@struts.apache.org
> Subject: [OT] SQL in XML file
> 
> 
> Hi
> Is there any code out there or any one worked on a
> framework, where we can define SQL statements in XML
> file and at runtime java program will read this XML
> file, build the SQL if prepared statement and execute
> it and return a ResultSet
> 
> What may be the points to be taken into consideration
> if i have to write a new one
> Ashish
> 
> 
> 		
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail Address AutoComplete - You start. We finish.
> http://promotions.yahoo.com/new_mail 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 

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


RE: [OT] SQL in XML file

Posted by Marco Mistroni <mm...@waersystems.com>.
Hello
	Hibernate does something like that, you may want to
Have a look at it..
Alternatively, I have done a similar thing for my own webapp,
Where I have  a 'persistence layer' that reads an xml config
File where I list all sql statements and mapping between
Columns and DTO fields (I user reflections for populating DTOs..)
I am using digester to build a Map out of the XML..
Not so difficult, however if there is a tool that does it
For you (Hibernate for example), it will save you time :-)

My 2 cents...

Regards
	marco

-----Original Message-----
From: Ashish Kulkarni [mailto:kulkarni_ash1312@yahoo.com] 
Sent: 27 October 2004 18:02
To: user@struts.apache.org
Subject: [OT] SQL in XML file

Hi
Is there any code out there or any one worked on a
framework, where we can define SQL statements in XML
file and at runtime java program will read this XML
file, build the SQL if prepared statement and execute
it and return a ResultSet

What may be the points to be taken into consideration
if i have to write a new one
Ashish


		
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 

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


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