ibatis-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kai Grabfelder <nos...@kaigrabfelder.de>
Subject Re: Object post processor feature request.
Date Mon, 27 Apr 2009 19:09:09 GMT
Please create a jira issue including a patch against the current ibatis trunk. We'll then have
a look into it.

cheers

Kai

--- Original Nachricht ---
Absender: Mark Miller
Datum: 27.04.2009 08:48
> Hello there,
> 
> I was wondering if it would be possible to add object post processing
> capabilities to iBatis.
> 
> We have found the need to set fields within business objects after they
> have been read from a database using iBatis. Up until now we have been using
> the row handler callback, however, when using iBatis lazy loading, this
> does no longer suffice.
> 
> To counter this we have added an interface to the iBatis package to
> allow for any implementors to be called after the object has been
> created and populated.
> 
> Below is the implementation that we have used, we feel that it would be
> a handy feature for the standard iBatis implementation.
> 
> Please let me know if this is possible.
> 
> Many thanks in advance,
> 
> Mark
> 
> ---------------------------------------
> 
> package com.ibatis.sqlmap.engine.mapping.statement;
> /**
>  * Post processor for ibatis created business objects.
>  * @author mima
>  */
> public interface IPostProcessor {
>         /**
>          * The callback called immediately after an object has been created
> and
> populated.
>          * @param results The result data. 
>          */
>         void postProcessCallback(Object[] results);
> }
> 
> --------------------------------------
> 
> com.ibatis.sqlmap.engine.mapping.statement.RowHandlerCallback
> 
>   public void handleResultObject(
>      .... CODE REMOVED
>       rowHandler.handleRow(object);
> 
>       if (object instanceof IPostProcessor) {
>           ((IPostProcessor) object).postProcessCallback(results);
>       }
>       
>     }
> }


Mime
View raw message