Return-Path: Delivered-To: apmail-incubator-ibatis-user-java-archive@www.apache.org Received: (qmail 67997 invoked from network); 24 May 2005 12:59:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 24 May 2005 12:59:35 -0000 Received: (qmail 84797 invoked by uid 500); 24 May 2005 12:59:33 -0000 Delivered-To: apmail-incubator-ibatis-user-java-archive@incubator.apache.org Received: (qmail 84777 invoked by uid 500); 24 May 2005 12:59:33 -0000 Mailing-List: contact ibatis-user-java-help@incubator.apache.org; run by ezmlm Precedence: bulk Reply-To: ibatis-user-java@incubator.apache.org List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list ibatis-user-java@incubator.apache.org Received: (qmail 84760 invoked by uid 99); 24 May 2005 12:59:33 -0000 X-ASF-Spam-Status: No, hits=1.8 required=10.0 tests=DNS_FROM_RFC_ABUSE,DNS_FROM_RFC_POST X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from web54007.mail.yahoo.com (HELO web54007.mail.yahoo.com) (206.190.36.231) by apache.org (qpsmtpd/0.28) with SMTP; Tue, 24 May 2005 05:59:31 -0700 Received: (qmail 39626 invoked by uid 60001); 24 May 2005 12:59:27 -0000 Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; b=aegnfRdpOXxl+2cCR99k/4jj8ylNZdvnsGAtcXBYlab363hh5+hdGQyu7Z1ehU1BvcwuG1PGJ1VveNXIx0WclWGQ75uOQu7EbnY+SpWPajfTQuwEoirTQhaUDc2JiPs3PgBkFcoKyqTgId8NXi3i6KIbn6iU//sWbFnuetXYeUg= ; Message-ID: <20050524125927.39624.qmail@web54007.mail.yahoo.com> Received: from [67.103.164.100] by web54007.mail.yahoo.com via HTTP; Tue, 24 May 2005 05:59:27 PDT Date: Tue, 24 May 2005 05:59:27 -0700 (PDT) From: Rob Butler Subject: Re: Feature Request To: ibatis-user-java@incubator.apache.org, Brandon Goodin In-Reply-To: 6667 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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 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 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