Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 99717 invoked from network); 7 Sep 2006 19:28:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 7 Sep 2006 19:28:27 -0000 Received: (qmail 66255 invoked by uid 500); 7 Sep 2006 19:28:24 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 66242 invoked by uid 500); 7 Sep 2006 19:28:24 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 66231 invoked by uid 99); 7 Sep 2006 19:28:24 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Sep 2006 12:28:24 -0700 X-ASF-Spam-Status: No, hits=2.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,HTML_MESSAGE,RCVD_IN_BL_SPAMCOP_NET,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of jeffgbutler@gmail.com designates 66.249.82.224 as permitted sender) Received: from [66.249.82.224] (HELO wx-out-0506.google.com) (66.249.82.224) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Sep 2006 12:28:23 -0700 Received: by wx-out-0506.google.com with SMTP id h30so375739wxd for ; Thu, 07 Sep 2006 12:28:00 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=RZG0KmU7rFXWJe9DdskYTYQbhCF8kWqXfOWL/S7MneOjQWL96W1ww0lPc8KuKd+nwBZTmS50zWw4ehdf4B2Uqq+L/1qZkobPZDfPCU4jw1gnNzLPe9MQBZd/5erzwICjtMThJmjPOqcTRwC78uUNSsl+NxLmQ0CQjzchuM5CTOU= Received: by 10.90.117.15 with SMTP id p15mr448727agc; Thu, 07 Sep 2006 12:28:00 -0700 (PDT) Received: by 10.90.118.17 with HTTP; Thu, 7 Sep 2006 12:27:59 -0700 (PDT) Message-ID: Date: Thu, 7 Sep 2006 14:27:59 -0500 From: "Jeff Butler" To: user-java@ibatis.apache.org Subject: Re: [2.2.0] Use case for ResultObjectFactory In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_55002_2345823.1157657279929" References: X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_55002_2345823.1157657279929 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Sure - feel free to open the issue with the Spring folks. I hope it works out well for you. Jeff Butler On 9/7/06, Christopher.Mathrusse@sybase.com < Christopher.Mathrusse@sybase.com> wrote: > > 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. > > ------------------------------ > *From:* "Jeff Butler" [mailto:"Jeff Butler" < > jeffgbutler@gmail.com>] > *Sent:* Thursday, September 07, 2006 10:27 AM > > *To:* user-java@ibatis.apache.org > *Subject:* Re: [2.2.0] Use case for ResultObjectFactory > > > I'm just getting around to adding to this discussion...I had to do some > investigation into Spring. > > iBATIS 2.2.0 would support injecting the result object factory from > Spring. The problem is that Spring's SqlMapClientFactoryBean needs some > changes. The result object factory could be injected in exactly the same > way that the transaction configuration is injected. > > 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: > > ExtendedSqlMapClient client = (ExtendedSqlMapClient) factory.getBean > ("sqlMapClient); > ResultObjectFactory rof = (ResultObjectFactory) factory.getBean > ("resultObjectFactory"); > client.getDelegate().setResultObjectFactory(rof); > > You could also create your own subclass of Spring's > SqlMapClientFactoryBean and do something similar: > > 1. override the afterPropertiesSet method > 2. call super.afterPropertiesSet() > 3. inject the result object factory as shown above (see the > applyTransactionConfig method as an example) > > Jeff Butler > > > > On 8/31/06, Christopher.Mathrusse@sybase.com > wrote: > > > > 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. > > > > 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. > > > > ------------------------------ > > *From:* Jan Vissers [mailto: Jan Vissers < > > Jan.Vissers@cumquat.nl>] > > *Sent:* Wednesday, August 30, 2006 10:30 PM > > *To:* user-java@ibatis.apache.org > > *Subject:* [2.2.0] Use case for ResultObjectFactory > > > > > > I'm trying to figure out why/when/how one would use a > > ResultObjectFactory - does anybody have a real practical use case for > > it? > > > > > > > > > ------=_Part_55002_2345823.1157657279929 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
Sure - feel free to open the issue with the Spring folks.  I hope it works out well for you.
 
Jeff Butler


 
On 9/7/06, Christopher.Mathrusse@sybase.com <Christopher.Mathrusse@sybase.com > wrote:
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.


From: "Jeff Butler" <jeffgbutler@gmail.com> [mailto:"Jeff Butler" < jeffgbutler@gmail.com>]
Sent: Thursday, September 07, 2006 10:27 AM
Subject: Re: [2.2.0] Use case for ResultObjectFactory

 
I'm just getting around to adding to this discussion...I had to do some investigation into Spring.
 
iBATIS 2.2.0 would support injecting the result object factory from Spring.  The problem is that Spring's SqlMapClientFactoryBean needs some changes.  The result object factory could be injected in exactly the same way that the transaction configuration is injected.
 
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:
 
ExtendedSqlMapClient client = (ExtendedSqlMapClient) factory.getBean("sqlMapClient);
ResultObjectFactory rof = (ResultObjectFactory) factory.getBean("resultObjectFactory");
client.getDelegate().setResultObjectFactory(rof);
 
You could also create your own subclass of Spring's SqlMapClientFactoryBean and do something similar:
 
1. override the afterPropertiesSet method
2. call super.afterPropertiesSet()
3. inject the result object factory as shown above (see the applyTransactionConfig method as an example)
 
Jeff Butler
 

 
On 8/31/06, Christopher.Mathrusse@sybase.com <Christopher.Mathrusse@sybase.com > wrote:
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.
 
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.
 

From: Jan Vissers <Jan.Vissers@cumquat.nl> [mailto: Jan Vissers <Jan.Vissers@cumquat.nl>]
Sent: Wednesday, August 30, 2006 10:30 PM
To: user-java@ibatis.apache.org
Subject: [2.2.0] Use case for ResultObjectFactory

 
I'm trying to figure out why/when/how one would use a
ResultObjectFactory - does anybody have a real practical use case for it?





------=_Part_55002_2345823.1157657279929--