ResultObjectFactory Object Creation Context
-------------------------------------------
Key: IBATIS-382
URL: https://issues.apache.org/jira/browse/IBATIS-382
Project: iBatis for Java
Issue Type: Improvement
Components: SQL Maps
Affects Versions: 2.3.0
Environment: Not relevant
Reporter: Murtaza Goga
Priority: Minor
The ResultObjectFactory is a great mechanism to allow the creation of objects
and their subsequent initialization in the factory. The ResultObjectFactory is
invoked with the statementID and Class of the object to be created. The
statementID is a good discriminator for the create operation to make decisions,
however the correlation to the object is not that strong. The resultMap
identifier or parameterMap identifier have a closer relationship to the object
being created.
This issue is about providing better context to the factory than just the
statement identifier.
There are some options which could be used to address this improvement:
1. Add an extended factory interface which takes a third parameter the
executing map id. ResultObjectFactoryMapIdAware.create(statementId, mapId,
Class)
2. System property to optionally append the map id to the statement id to the
delimiter. (statementId#resultMapId)
3. Changes in the resulMap configuration to pass custom parameters to the
factory from the resultMap. N child elements <factoryParam name="foo"
value="bar />.
I have patches for 1 and 2, but I have not spent much time on 3, since it is a
bit intrusive. It does offer the most flexibility though.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira