ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clinton Begin <clinton.be...@gmail.com>
Subject Re: Custom ResultSet handler
Date Tue, 02 Feb 2010 15:55:03 GMT
The original question sort of implied an answer, which might have us all
missing the goals.

For example, to map directly to XML, there's no need to replace the
ResultSetHandler.  Perhaps the confusion is that the op might have been
referring to Spring's ResultSetHandler, which is a completely different
construct.

In iBATIS, if you want to support a different result type, it's done at a
much different level.

The ObjectWrapperFactory interface is a sort of plug-in that allows iBATIS
to be extended to support different types (like Scala objects, or XML).  The
only two supported by iBATIS out of the box are Java POJOs/Beans and Maps
(like HashMap).

The interface is pretty simple.  However I recommend looking at the other
implementations, including the Scala one, to see how it should be
implemented.

public interface ObjectWrapperFactory {
  boolean hasWrapperFor(Object object);
  ObjectWrapper getWrapperFor(MetaObject metaObject, Object object);
}

Cheers,
Clinton

On Tue, Feb 2, 2010 at 2:20 AM, Stephen Friedrich <
stephen.friedrich@fortis-it.eu> wrote:

> I am also interested in this feature:
> Much of my code uses ibatis to generate beans, then works on those.
> However I have existing code that takes an Excel-template and a JDBC
> result set and fills the excel file using apache poi.
> I would very much like to re-use the existing ibatis-queries (including
> their dynamic parts).
>
> Another option for me would be to somehow get the final SQL statement and
> parameters, then execute that statement myself. Is that possible somehow?
>
> -----Urspr√ľngliche Nachricht-----
> Von: costab [mailto:k444@nym.hush.com]
> Gesendet: Montag, 1. Februar 2010 23:24
> An: user-java@ibatis.apache.org
> Betreff: Custom ResultSet handler
>
>
> I am a newbie to ibatis and I want to figure out where iBatis would fit to
> solve my requirements.
>
> Is it possible in iBatis 3.0 (or 2.x) to provide my own ResultSet handler?
> I
> read the documentation and it is seems that I would have to use a plugin to
> do that. Are there any samples on how to do it? Can I specify what plug-in
> I
> want to use for specific select elements? For some queries I want to leave
> to iBatis to do the mapping for others I want to specify my own handler.
>
>
>
>
> --
> View this message in context:
> http://old.nabble.com/Custom-ResultSet-handler-tp27412455p27412455.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>

Mime
View raw message