ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Shpak <o...@rap-x.com>
Subject Re: Handle resultset manually
Date Thu, 13 Oct 2005 11:34:15 GMT
Hi Niels,

thanks for your reply. I use TypeHandlerCallback interface in my 
application, but it is designed to map individual columns to custom 
types. For example, I use it for mapping integer IDs to Java 5 enums and 

I'm uncertain whether iBatis developers encourage the use of 
TypeHandlerCallback interface you suggest. Anyway it is not much better 
than use of a data holder type, because it as well requires an 
additional 'artificial' type (myClass in your example) and post processing.
Also, because TypeHandlerCallback instances are created by the 
framework, I cannot pass any parameters/references to them, which is a 
severe limitation for me.


Niels Beekman wrote:

>You could use the TypeHandlerCallback-interface.
><resultMap id="myResultMap" class="myClass">
>  <result column="myColumn" property="myProperty"
>class MyHandlerCallback implements TypeHandlerCallback {
>  ...
>  public Object getResult(ResultGetter getter) throws SQLException {
>	ResultSet rs = getter.getResultSet();
>	MyCustomResult foo = doSomethingWithResultSet(rs);
>	return foo;
>  }
>  public MyCustomResult doSomethingWithResultSet(ResultSet rs) {
>    ...
>    return null;
>  }
>  ...
>That should work, never used it though...
>-----Original Message-----
>From: Oleg Shpak [mailto:oleg@rap-x.com] 
>Sent: donderdag 13 oktober 2005 12:22
>To: user-java@ibatis.apache.org
>Subject: Handle resultset manually
>I really like all the stuff iBatis does, including the easy way of 
>creating dynamic SQL statements.
>But rarely I need to handle resultsets manually. Unfortunately resultMap
>tag functionality is not enough sometimes
>Currently I have to create a data holder class which captures the 
>resultset data, later I post process the returned list.
>I'm aware of RowHandler interface, but it solves a different kind of 
>Could you please advise me what is the best currently possible solution 
>for cases where resultMap tag functionality is not enough?
>Can I work with the returned resultset directly?

View raw message