ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher.Mathru...@sybase.com
Subject RE: [2.2.0] Use case for ResultObjectFactory
Date Thu, 07 Sep 2006 17:52:20 GMT
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META boundary="----=_Part_52419_31763773.1157650009419" alternative; multipart 
Content-Type:>
<META http-equiv=Content-Type content="text/html; charset=us-ascii" 
Content-Type: ------="_Part_52419_31763773.1157650009419" inline 
Content-Disposition: html; text 7bit Content-Transfer-Encoding:>
<META content="MSHTML 6.00.2900.2963" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN 
class=509105017-07092006>Thanks for the follow-up Jeff. I'll look into 
implementing this as I like it as a solution better than the way I currently 
have it. If you would like I would be willing to open an issue with Spring to 
see if we can get this functionality added. I've seen some rather fast 
resolutions to some requests by the Spring team.</SPAN></FONT></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> "Jeff Butler" 
&lt;jeffgbutler@gmail.com&gt; [mailto:"Jeff Butler" 
&lt;jeffgbutler@gmail.com&gt;] <BR><B>Sent:</B> Thursday, September
07, 2006 
10:27 AM<BR><B>To:</B> user-java@ibatis.apache.org<BR><B>Subject:</B>
Re: 
[2.2.0] Use case for ResultObjectFactory<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV>I'm just getting around to adding to this discussion...I had to do some 
investigation into Spring.</DIV>
<DIV>&nbsp;</DIV>
<DIV>iBATIS 2.2.0&nbsp;would support injecting the result object factory from 
Spring.&nbsp; The problem is that Spring's SqlMapClientFactoryBean&nbsp;needs 
some changes.&nbsp; The result object factory could be injected in exactly the 
same way that the transaction configuration is injected. </DIV>
<DIV>&nbsp;</DIV>
<DIV>Assuming that it might take some time to get Spring's 
SqlMapClientFactoryBean changed, you could also inject the factory yourself 
using a bit of Java code as follows:</DIV>
<DIV>&nbsp;</DIV>
<DIV>ExtendedSqlMapClient client = (ExtendedSqlMapClient) 
factory.getBean("sqlMapClient);</DIV>
<DIV>ResultObjectFactory rof = (ResultObjectFactory) 
factory.getBean("resultObjectFactory");</DIV>
<DIV>client.getDelegate().setResultObjectFactory(rof);</DIV>
<DIV>&nbsp;</DIV>
<DIV>You could also create your own subclass of Spring's SqlMapClientFactoryBean 
and do something similar:</DIV>
<DIV>&nbsp;</DIV>
<DIV>1. override the afterPropertiesSet method</DIV>
<DIV>2. call super.afterPropertiesSet()</DIV>
<DIV>3. inject the result object factory as shown above (see the 
applyTransactionConfig method as an example)</DIV>
<DIV>&nbsp;</DIV>
<DIV>Jeff Butler</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR>&nbsp;</DIV>
<DIV><SPAN class=gmail_quote>On 8/31/06, <B class=gmail_sendername><A

href="mailto:Christopher.Mathrusse@sybase.com">Christopher.Mathrusse@sybase.com</A></B>

&lt;<A 
href="mailto:Christopher.Mathrusse@sybase.com">Christopher.Mathrusse@sybase.com 
</A>&gt; wrote:</SPAN> 
<BLOCKQUOTE class=gmail_quote 
style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
  <DIV>
  <DIV>
  <DIV dir=ltr align=left><SPAN><FONT color=#0000ff size=2>I was one of
the 
  requestors of this functionality. The practical use case for this was to be 
  able to specify an object factory that could instantiate objects rather than 
  having iBatis use the newInstance() method. This would allow for someone to 
  specify an object factory that could potentially return objects, for example, 
  from the Spring container. While the interface does define an API for creating 
  such an object factory it is incomplete of what is actually needed. The 
  interface defines a way to return requested objects but requires that the 
  implementing class provide a no argument constructor. This has some serious 
  limitations. </FONT></SPAN></DIV>
  <DIV dir=ltr align=left><SPAN><FONT color=#0000ff 
  size=2></FONT></SPAN>&nbsp;</DIV>
  <DIV dir=ltr align=left><SPAN><FONT color=#0000ff size=2>To better complete

  this requirement we need a way to inject the ResultObjectFactory into iBatis 
  rather that iBatis instantiating the implementation. While I have found a way 
  to get this to work within the Spring container I feel that it is less than 
  elegant and would welcome the ability to inject the ResultObjectFactory into 
  iBatis. </FONT></SPAN></DIV>
  <DIV dir=ltr align=left><SPAN><FONT color=#0000ff 
  size=2></FONT></SPAN>&nbsp;</DIV>
  <DIV lang=en-us dir=ltr align=left>
  <HR>
  <FONT face=Tahoma size=2><B>From:</B> Jan Vissers &lt;<A 
  onclick="return top.js.OpenExtLink(window,event,this)" 
  href="mailto:Jan.Vissers@cumquat.nl" 
  target=_blank>Jan.Vissers@cumquat.nl</A>&gt; [mailto:<A 
  onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:Jan" 
  target=_blank> Jan</A> Vissers &lt;<A 
  onclick="return top.js.OpenExtLink(window,event,this)" 
  href="mailto:Jan.Vissers@cumquat.nl" 
  target=_blank>Jan.Vissers@cumquat.nl</A>&gt;] <BR><B>Sent:</B>
Wednesday, 
  August 30, 2006 10:30 PM<BR><B>To:</B> <A 
  onclick="return top.js.OpenExtLink(window,event,this)" 
  href="mailto:user-java@ibatis.apache.org" 
  target=_blank>user-java@ibatis.apache.org</A><BR><B>Subject:</B>
[2.2.0] Use 
  case for ResultObjectFactory<BR></FONT><BR>&nbsp;</DIV></DIV>
  <DIV><SPAN class=q>
  <DIV></DIV>I'm trying to figure out why/when/how one would use a 
  <BR>ResultObjectFactory - does anybody have a real practical use case for it? 
  <BR><BR><BR><BR></SPAN></DIV>
  <DIV></DIV></DIV></BLOCKQUOTE></DIV><BR></BODY></HTML>


Mime
View raw message