Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 72241 invoked from network); 8 Jan 2007 08:15:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Jan 2007 08:15:03 -0000 Received: (qmail 23688 invoked by uid 500); 8 Jan 2007 08:15:03 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 23671 invoked by uid 500); 8 Jan 2007 08:15:03 -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 23659 invoked by uid 99); 8 Jan 2007 08:15:03 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Jan 2007 00:15:03 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of carfield@gmail.com designates 64.233.182.189 as permitted sender) Received: from [64.233.182.189] (HELO nf-out-0910.google.com) (64.233.182.189) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Jan 2007 00:14:54 -0800 Received: by nf-out-0910.google.com with SMTP id l24so8605768nfc for ; Mon, 08 Jan 2007 00:14:33 -0800 (PST) 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:content-transfer-encoding:content-disposition:references; b=Aajvc8yDvsN79HXnjGsSMxaeM+M499TgaZ2W4qXfzhFznZv1sh3He2uOBV92Nal/Id0waWhKaI9ipBFK2OLF1oBou9+1XI6h5dBU4FAG5HaktC1pb9sD5s8Q0NWloCYbDsnGwburP/5b9Z9cm8tVPiyb6jVER7d8LGv2HEMwqYI= Received: by 10.82.167.5 with SMTP id p5mr2942263bue.1168244073328; Mon, 08 Jan 2007 00:14:33 -0800 (PST) Received: by 10.82.180.5 with HTTP; Mon, 8 Jan 2007 00:14:33 -0800 (PST) Message-ID: Date: Mon, 8 Jan 2007 16:14:33 +0800 From: "Carfield Yim" To: user-java@ibatis.apache.org Subject: Re: Can ibatis work with java object with constructor have parameters? In-Reply-To: <2fe5ef5b0701072100h38e35760j965e87310031f414@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <299154da0701071826m414c4c67m4118936fe57752a@mail.gmail.com> <567624C728CF6544ADFCB285B34D5B931897CF@ms07.mse2.exchange.ms> <2fe5ef5b0701072015s60ecf227r7bf521aa35356e87@mail.gmail.com> <2fe5ef5b0701072045j10b88395j69f76fe2348f2b97@mail.gmail.com> <2fe5ef5b0701072100h38e35760j965e87310031f414@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org Just really read http://ibatis.apache.org/docs/java/dev/com/ibatis/sqlmap/client/event/RowHandler.html , However can I get the resultset from the RowHandler? On 1/8/07, Brandon Goodin wrote: > Sounds like you can use a RowHandler for this. > > > Brandon > > On 1/7/07, Carfield Yim wrote: > > Actually I get I cannot do... but anyway, just ask. > > > > For method > http://ibatis.apache.org/docs/java/dev/com/ibatis/sqlmap/engine/mapping/result/ResultObjectFactory.html#createInstance(java.lang.String, > > java.lang.Class) > > > > instead of having > > public Object ResultObjectFactory(String id, Class clazz) { > > Constructor con = clazz.getDeclaredConstructor(new > Class[]{String.class}); > > return con.newInstance(objectStaticAvailable); > > } > > > > Can I init the object using resultset result, like > > > > public Object ResultObjectFactory(String id, ResultSet rs, Class clazz) { > > Constructor con = clazz.getDeclaredConstructor(new > Class[]{String.class}); > > return con.newInstance(rs.getString("id")); > > } > > > > So that I can use the ID of the record to check for permission when > > initalization. If the user don't have permission to load that record, > > the system will throw an exception and we will show an generic > > permission deny page. > > > > On 1/8/07, Brandon Goodin < brandon.goodin@gmail.com> wrote: > > > I'm not completely sure what you are asking. But, if you are asking if > you > > > can get the ResultSet itself that would be a no. iBATIS is JDBC wrapper. > If > > > you find that you need more direct access to JDBC then you should use > JDBC > > > directly. > > > > > > > > > Brandon > > > > > > On 1/7/07, Carfield Yim wrote: > > > > Can I get the reference of resultset when the object is initalizating? > > > > > > > > On 1/8/07, Brandon Goodin wrote: > > > > > You can find the javadoc here: > > > > > > > > > > > > > > http://ibatis.apache.org/docs/java/dev/com/ibatis/sqlmap/engine/mapping/result/ResultObjectFactory.html > > > > > > > > > > I was assuming you were wanting to map result values to a > constructor. > > > If > > > > > you are trying to map results to a constructor, it would seem a > tedious > > > > > effort to use the ResultObjectFactory for this. > > > > > > > > > > I know it is lame that we don't have this functionality. But, we've > > > > > discussed adding the constructor mapping functionality and have > decided > > > it > > > > > is best to delay adding it until iB3 (no eta). > > > > > > > > > > Brandon > > > > > > > > > > > > > > > On 1/7/07, Carfield Yim wrote: > > > > > > I just check for the document and I cannot see those APIs , > > > > > > http://ibatis.apache.org/docs/java/user/ , am I > > > looking > > > > > for wrong > > > > > > thing? > > > > > > > > > > > > On 1/8/07, Goga, Murtaza < murtaza.goga@trisyngroup.com> wrote: > > > > > > > Have you considered using an implementation of > ResultObjectFactory? > > > It > > > > > can be configured within iBatis or injected into the > > > SqlMapExecutorDelegate. > > > > > Either ways you will have control over the creation and subsequent > > > > > initialization of objects. > > > > > > > > > > > > > > ________________________________ > > > > > > > > > > > > > > From: Peng Wang [mailto: wpcfan@gmail.com ] > > > > > > > Sent: Sun 1/7/2007 9:26 PM > > > > > > > To: user-java@ibatis.apache.org > > > > > > > Subject: Re: Can ibatis work with java object with constructor > have > > > > > parameters? > > > > > > > > > > > > > > > > > > > > > You can do this using Spring. I think iBatis does not have to > > > support > > > > > this. > > > > > > > > > > > > > > > > > > > > > On 1/8/07, Carfield Yim < carfield@gmail.com > wrote: > > > > > > > > > > > > > > To bad to hear that, is it planned to be implemented? > > > > > > > > > > > > > > On 1/8/07, Brandon Goodin < brandon.goodin@gmail.com> > wrote: > > > > > > > > This is not currently implemented. > > > > > > > > > > > > > > > > Brandon > > > > > > > > > > > > > > > > > > > > > > > > On 1/6/07, Carfield Yim < carfield@gmail.com > > > > > > wrote: > > > > > > > > > I like to pass something to the object while > > > initalization, > > > > > can I > > > > > > > > > specific about that? > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >