[jira] Commented: (IBATIS-594) Object post processor feature request.
[ 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.
[ 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.
[ 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.
[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.
Re: Object post processor feature request.
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); > } > > } > }
Object post processor feature request.
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); } } } -- View this message in context: http://www.nabble.com/Object-post-processor-feature-request.-tp23250996p23250996.html Sent from the iBATIS - Dev mailing list archive at Nabble.com.