ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Lamey <cla...@localmatters.com>
Subject Re: Retrieve the SQL statement being executed
Date Mon, 10 Mar 2008 04:31:40 GMT
I'm not sure why a RowHandler wouldn't fit your needs.  It basically is a
callback that gets invoked on each row returned from the query.  Only one
resultant row is mapped at a time, so the memory usage is very small.  The
result does get mapped into an object, but the overhead is minimal - and you
can map it to a java.util.Map if you want it to look more like a ResultSet.

The amount of effort to get a RowHandler working for you compared to the
effort of getting at iBATIS' generated SQL without actually using the SqlMap
to execute the query doesn't seem close.

But then, I could be misunderstanding your situation...

On 3/9/08 8:44 PM, "Ricky Murphy" <rickytrsbin@hotmail.com> wrote:

> Thank you for your reply. Well, I have no problem doing log activity. let me
> elaborate what I want to do. I have a SQLMap file which contains all my SQLs
> maps related to the same domain. In one case, I need to use ResultSet directly
> and not need iBatis. However, I want to keep all domain related SQLs in the
> same place.    In iBatis, it seems there is no decent way to handle this
> (RowHandler seems to get the result up in memory (i,e, after data is obtained,
> the db connection is closed) first, then I can treat each row as a object. I
> don't want to go that extra step. To work with each row in ResultSet seemed to
> be efficient to me without extra steps. This is the only SQL that does not
> need iBatis. However, in order to keep all SQL maps that tackle the same
> domain of problems together, I want to put this special SQL together with
> sqlMaps together in the same XML file. Because this, I want sqlMapClient to
> somehow read the SQL and then in my code retrieve the SQL and execute it with
> Spring jdbcTemplate to get my resultSet. I hope that I explained clearly.
> iBatis has a session scope, and requestScope objects that seem to be OK to get
> the SQL statement. however, they are protect method and not open to public.
> Therefore, I am trying to see if there is any way to get that SQL before it is
> executed. 
> -Rick
> From: nathan.maves@gmail.com
> To: user-java@ibatis.apache.org
> Subject: Re: Retrieve the SQL statement being executed
> Date: Sat, 8 Mar 2008 07:33:38 -0700
> Please take a look at the logging section in one of the following 3
> places...The websiteThe developers guideThe book
> Sent from my iPhone
> On Mar 8, 2008, at 5:55 AM, Ricky Murphy <rickytrsbin@hotmail.com> wrote:
> Hello: 
> I am using Spring 2 together with iBatis 2.2. I need in my program to retrieve
> the SQL statement being executed from the SqlMap.
> Spring's SqlMapClientDaoSupport class has getSqlMapClient() ,which gives
> com.ibatis.sqlmap.client.SqlMapClient as a result object, from there on, I
> started searching thru all related the iBatis classes, haven't found one
> method that will return the SQL statement being executed. Please advise.
> Thank you.
> -Rick
> Connect and share in new ways with Windows Live. Get it n
> _________________________________________________________________
> Climb to the top of the charts! Play the word scramble challenge with star
> power.
> http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_jan

View raw message