ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Butler <crodste...@yahoo.com>
Subject Re: Feature Request
Date Tue, 24 May 2005 15:54:02 GMT
Isn't that what I just did?  :)

I don't have a Jira account for iBatis, so could
someone add this for me?

Thanks
Rob
--- Brandon Goodin <brandon.goodin@gmail.com> wrote:

> Oh duh. haha. sorry. Read it quick. Should have
> taken a few more seconds.
> 
> Follow the second temp file suggestion for now. It
> is not a terribly
> difficult way to solve this at all. Please put a
> feature request in
> for this. I'm not sure we will add this feature.
> But, at least get it
> in the que so that we can discuss it.
> 
> Brandon
> 
> On 5/24/05, Rob Butler <crodster2k@yahoo.com> wrote:
> > Because, as I said below, SqlMapClientBuilder
> requires
> > the SqlMapConfig file.  So if I use StringReader
> to
> > pass in the SqlMapConfig file, that works fine. 
> But
> > the SqlMapConfig file must then reference the
> SqlMap
> > file, and this file must be loaded either as a
> > resource from the classpath, or as a URL.  Since
> this
> > file doesn't actually exist on disk, or in the
> > classpath loading as a resource isn't going to
> work.
> > 
> > So that leaves URL as the last hope.  Java
> supports
> > http, ftp, and file protocols by default.  Since
> the
> > file isn't on disk, file isn't going to help.  I
> don't
> > want to embed an http or ftp server in my app just
> to
> > load a dynamicly generated segment of xml from
> memory,
> > so http and ftp are out too.
> > 
> > URL could still work if I implement my own
> protocol
> > and add that to the one's the JVM can use,
> something
> > like mem://fake-file-name.  Java supports this,
> but it
> > seems a bit extreme that I need to create an
> entirely
> > new protocol to load some dynamically generated
> XML
> > from memory into iBatis doesn't it?
> > 
> > So while I could implement something to do what I
> need
> > all in memory, or could use temp files as someone
> > suggested, the best way to do it in my opinion is
> add
> > the capability to iBatis and not have to work
> around
> > this unnecessary limitation.
> > 
> > Seeing as I need this capability, and someone else
> has
> > resorted to using temp files to accomplish the
> same
> > thing, it sounds like it would be a useful feature
> to
> > have.
> > 
> > Thanks for the suggestions though.
> > Rob
> > 
> > 
> > --- Brandon Goodin <brandon.goodin@gmail.com>
> wrote:
> > > SqlMapClientBuilder takes a reader. If you have
> a
> > > String in memory
> > > then why couldn't you use a StringReader?
> > >
> > > Brandon
> > >
> > > On 5/23/05, Rob Butler <crodster2k@yahoo.com>
> wrote:
> > > > Hello,
> > > >
> > > > I am building an application that will need to
> > > > dynamically build an SQL statement at run
> time,
> > > and
> > > > then populate the statement's fields from a
> map.
> > > > Sounds perfect for iBatis, right.  That's what
> I
> > > > thought, but I don't think iBatis does quite
> what
> > > I
> > > > need.  Normally iBatis can dynamically change
> it's
> > > SQL
> > > > but you need to know things like the number,
> name
> > > &
> > > > type of columns in advance when the SqlMap is
> > > created.
> > > >
> > > > Unfortunately in my application, the SQL
> statement
> > > > that is built at runtime is completely
> dynamic.
> > > The
> > > > name of the columns, their data types and the
> > > number
> > > > of columns will only be known at run time.  So
> > > what I
> > > > would like to do is dynamically instantiate an
> > > > SqlMapClient from a String, which contains the
> > > SqlMap
> > > > that is dynamically generated at run time. 
> Then
> > > let
> > > > iBatis do the work of converting the map's
> values
> > > into
> > > > the correct data types and populating the
> SQL's
> > > field
> > > > values.  It would be nice if the table name
> could
> > > be
> > > > passed as a property instead of in the map of
> > > data.
> > > >
> > > > This looks like it would be possible with the
> > > > SqlMapClientBuilder, but I don't think that is
> > > going
> > > > to work.  The problem is it wants to read an
> > > > SqlMapConfig, which then of course points to
> an
> > > SqlMap
> > > > file.  However, the SqlMap file obviously
> won't
> > > exist
> > > > anywhere but as a string in ram, and it's not
> > > possible
> > > > (as far as I know) to directly load an SqlMap
> > > using
> > > > SqlMapClientBuilder, nor is it possible to
> load a
> > > > single "file" (string in ram) that is a
> combined
> > > > SqlMapConfig & SqlMap.
> > > >
> > > > I could probably cobble something together
> using
> > > the
> > > > internal non-user exposed classes within
> iBatis,
> > > but
> > > > then if those classes change from one release
> to
> > > the
> > > > next I would have to make the appropriate
> changes
> > > to
> > > > my code, and I would prefer to use something
> that
> > > is
> > > > part of iBatis.
> > > >
> > > > So, I would like to request a feature to make
> > > > dynamically building the SqlMap at runtime
> > > possible.
> > > > I suppose this could be done by developing a
> class
> > > > like SqlMapClientBuilder that accepted a
> String,
> > > and
> > > > didn't need an SqlMapConfig, just a SqlMap
> XML.
> > > > Alternately, a fixed API could be exposed to
> users
> > > to
> > > > manually construct a SqlClientMap.
> > > >
> > > > Thoughts?  Is there a better approach that
> works
> > > now?
> > > > Did I miss something obvious?
> > > >
> > > > Thanks, and iBatis rocks!
> > > > Rob
> > > >
> > > >
> > > >
> > > > __________________________________
> > > > Do you Yahoo!?
> > > > Yahoo! Small Business - Try our new Resources
> site
> > > > http://smallbusiness.yahoo.com/resources/
> > > >
> > >
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam
> protection around
> > http://mail.yahoo.com
> >
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Mime
View raw message