[ 
http://issues.apache.org/jira/browse/IBATIS-84?page=comments#action_60304 ]
     
Tak Yoshida commented on IBATIS-84:
-----------------------------------

Clinton,

Thanks for your time. I really appreciate it.

>Looking into this a bit further, I wonder if you could manage this using 
>either:
>1) A custom cache model implementation (preferred).
>My recommendation is to write a custom cache model.  If there is a hook that 
>you need (such as more 
>specific manual flush capability), then let's look at that.
Sure, I see your point. 
If I use this, no futher complexity will be introduced, and it follows the 
SQLMap design policy.
I will definitely take a look custom cache model again first.
Unfortunately, our project will be in final testing phase very soon.
so I will do this as a enhancement project for my app.

One simple concern is that all our service objects, e.g. our cache service, are 
managed by Spring,
and how my own custom cache model can work with these services,
in other words, how to get the cache service object. 
Well, I'll see.

>or
>2) A custom type handler.
I haven't think about CTH for my case.
But if I can inject my own DAO instance into it,
I can do the same thing as I am doing via external service.
Is there any way to work with Factory (such as Spring) to instantiate SQLMap 
object?
Oops, back to the same discussion, again. please forget about this until I 
study cache model.

Later,
Tak

> Enhancement proposal: plug in external bean
> -------------------------------------------
>
>          Key: IBATIS-84
>          URL: http://issues.apache.org/jira/browse/IBATIS-84
>      Project: iBatis for Java
>         Type: New Feature
>   Components: SQL Maps
>     Versions: 2.0.9b
>     Reporter: Tak Yoshida

>
> Hello SQLMap development team,
> I would like to post this idea again,
> which was submitted to sourceforge forum last year.
> I believe this is not only for my case in real world, 
> and makes SQLMap more flexible. 
>  
> I have already done on 2.0.9b, and it works pretty well on my project.
> If you would reflect my proposal in the future SQLMap, that would be great. 
> thanks,
> Tak Yoshida
> -------- Here is the post on Oct 30th for 2.0.7 --------
> I found one thing I should ask,
> that is external service bean plug in feature for the complex object query. 
>  
> In my project, I need to use Oracle Object Cache Service for disributed  
> application environment. 
> and this cache will be managed outside of SQLMap framework, 
> which mean I cannot use SQLMap cache plugin mechanism where SQLMap manages 
> cache object itself.
>  
> So I would like to have SQLMap call external service for complex object's sub 
> query. 
>  
> Here is my proposal:
> Summary: 
> Inject ServiceLocator to make SQLMap be able to call the service managed  
> outside of SQLMap. 
>  
> 1: To make use of external object, SqlMapClient has UserServiceBeanLocator 
> object property. 
>  
> public interface SqlMapClient extends SqlMapExecutor,  
> SqlMapTransactionManager { 
> public void setUserServiceBeanLocator(UserServiceBeanLocator 
> serviceBeanLocator); 
> public UserServiceBeanLocator getUserServiceBeanLocator(); 
> .... 
> } 
> And SqlMapClientImpl has this imlementation. 
>  
> public interface UserServiceBeanLocator { 
> // locator method 
> public Object getUserServiceBean(String name) throws SqlMapException; 
> } 
>  
>  
> 2: Extends resultMap's "result" tag attribute to specify the external bean 
> and the method name. 
>  
> <result property="shipMode" column="SMODE" javaType="string" 
> bean="shipModeDao" method="getShipModeById"/> 
> instead of 
> <result property="shipMode" column="SMODE" 
> select="shipModeSqlMap.getShipModeById"/> 
>  
> 3: To support 2, DTD must be enhanced for new two attributes, and  
> XmlSqlMapClientBuilder must support it. --> SQLMapParser on 2.0.9b
>  
> 4: And to hold these external bean info in mapping object created by 
> XmlSqlMapClientBuilder, 
> I introduce UserServiceBeanInfo. 
> public class UserServiceBeanInfo { 
> private String beanName; 
> private String methodName; 
> private Method method; 
> ... 
> } 
>  
> 5: Utilizing aboves, BasicResultMap.getResults() method can do nested quesry 
> for the complex property by calling external service. 
>  
> Here is a snippet of the codes 
> } else if (mapping.getUserServiceBeanInfo() != null) { 
> // get key for complex property 
> Object rawValue = getPrimitiveResultMappingValue(rs, mapping); 
> // get complex property via external service 
> UserServiceBeanLocator serviceBeanLocator =  
> request.getSession().getSqlMapClient().getUserServiceBeanLocator(); 
> UserServiceBeanInfo serviceBeanInfo = mapping.getUserServiceBeanInfo(); 
> try { 
> Object service = 
> serviceBeanLocator.getUserServiceBean(serviceBeanInfo.getBeanName()); 
> Method method = serviceBeanInfo.getMethod(); // check cacheed one. 
> if (method == null) { 
> method = service.getClass().getMethod(serviceBeanInfo.getMethodName(), new 
> Class[] {mapping.getJavaType()}); 
> serviceBeanInfo.setMethod(method); // cache it. 
> } 
> columnValues[i] = method.invoke(service, new Object[] {rawValue}); 
> ... exception handling... 
> } else { 
>  
> 6: Application is fully responsible to set this up at startup time. 
> I am injecting spring ApplicationContext object to SqlMapClient via 
> ApplicationListener, 
> -------------------------------

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira

Reply via email to