You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "Mark Miller (JIRA)" <ib...@incubator.apache.org> on 2009/04/28 09:40:30 UTC

[jira] Created: (IBATIS-594) Object post processor feature request.

Object post processor feature request.
--------------------------------------

                 Key: IBATIS-594
                 URL: https://issues.apache.org/jira/browse/IBATIS-594
             Project: iBatis for Java
          Issue Type: Improvement
          Components: DAO
    Affects Versions: 2.3.4, 2.3.5
         Environment: All platforms.
            Reporter: Mark Miller
            Priority: Minor
             Fix For: 2.3.5, 2.3.4
         Attachments: postprocessor.patch

add object post processing capabilities to iBatis after objects have been populated from the recordset.

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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (IBATIS-594) Object post processor feature request.

Posted by "Stefan Gmeiner (JIRA)" <ib...@incubator.apache.org>.
    [ https://issues.apache.org/jira/browse/IBATIS-594?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12708008#action_12708008 ] 

Stefan Gmeiner commented on IBATIS-594:
---------------------------------------

I find the idea of "post processing" an object a good idea but I think there
should be a more generic solution. I attached a patch which delegates the
creation of the RowHandlerCallback into a factory. This allows to replace
or extends the default implementation with custom actions like post
processing of some of the objects.

The advantage of this patch is that the user of iBatis have much more
control of the creation of objects opposed to the post processor interface.
For example he could replace the whole object through a proxy, etc.

In the patch the factory for RowHandlerCallback is configured in the
SQL-Map config through a static class RowHandlerCallbackFactoryUtil. I'm
not sure if this is the appropriate way to do it. I also recognized that
in case of multiple result sets a DefaultRowHandler is used for subsequent
result sets. I think this could be problematic if a custom RowHandler is
used which derives from DefaultRowHandler. In this case the custom handler
is not used for the subsequent result sets.


> Object post processor feature request.
> --------------------------------------
>
>                 Key: IBATIS-594
>                 URL: https://issues.apache.org/jira/browse/IBATIS-594
>             Project: iBatis for Java
>          Issue Type: Improvement
>          Components: DAO
>    Affects Versions: 2.3.4
>         Environment: All platforms.
>            Reporter: Mark Miller
>            Priority: Minor
>         Attachments: postprocessor.patch
>
>
> add object post processing capabilities to iBatis after objects have been populated from the recordset.
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (IBATIS-594) Object post processor feature request.

Posted by "Mark Miller (JIRA)" <ib...@incubator.apache.org>.
    [ https://issues.apache.org/jira/browse/IBATIS-594?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12704965#action_12704965 ] 

Mark Miller commented on IBATIS-594:
------------------------------------

In our use case, we have business objects that can track their own persistence state. When an attribute is changed, the persistence state is set to 'dirty', and once saved the persistence state is set to 'persisted'.

The problem occurs when we instantiate an object, it should either be 'persisted' or 'new', 'persisted' when being read from the database and 'new' when created. We set all our objects initially to 'new', the callback helps us to make sure that objects instantiated via iBatis can set their persistence state to 'persisted'.

Originally we did this using the row handler, but this doesn't take into account objects instantiated through iBatis lazy loading.

The Object[] results argument is not necessary for our case, however I thought that if it was included (doesn't cost anything) it might make the call back useful in other situations.

Mark


> Object post processor feature request.
> --------------------------------------
>
>                 Key: IBATIS-594
>                 URL: https://issues.apache.org/jira/browse/IBATIS-594
>             Project: iBatis for Java
>          Issue Type: Improvement
>          Components: DAO
>    Affects Versions: 2.3.4
>         Environment: All platforms.
>            Reporter: Mark Miller
>            Priority: Minor
>         Attachments: postprocessor.patch
>
>
> add object post processing capabilities to iBatis after objects have been populated from the recordset.
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (IBATIS-594) Object post processor feature request.

Posted by "Kai Grabfelder (JIRA)" <ib...@incubator.apache.org>.
    [ https://issues.apache.org/jira/browse/IBATIS-594?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12704926#action_12704926 ] 

Kai Grabfelder commented on IBATIS-594:
---------------------------------------

so value objects implementing the new interface would called after beeing instanziated. And what kind of action would you do in the implementation of postProcessCallback(Object[] results). Maybe I'll understand the need for this change better if you attach a new unit test that is using the new functionality.

> Object post processor feature request.
> --------------------------------------
>
>                 Key: IBATIS-594
>                 URL: https://issues.apache.org/jira/browse/IBATIS-594
>             Project: iBatis for Java
>          Issue Type: Improvement
>          Components: DAO
>    Affects Versions: 2.3.4
>         Environment: All platforms.
>            Reporter: Mark Miller
>            Priority: Minor
>         Attachments: postprocessor.patch
>
>
> add object post processing capabilities to iBatis after objects have been populated from the recordset.
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.