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" <[EMAIL PROTECTED]> 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:[EMAIL PROTECTED]
> 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" <[EMAIL PROTECTED]>
> 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:[EMAIL PROTECTED]
> > Sent: Wednesday, October 27, 2004 1:02 PM
> > To: [EMAIL PROTECTED]
> > 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:
> > [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!?
> Yahoo! Mail Address AutoComplete - You start. We
> finish.
> http://promotions.yahoo.com/new_mail
> 
>
---------------------------------------------------------------------
> 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]
> 
> 


=====
A$HI$H


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

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to