Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 22389 invoked from network); 30 Jan 2008 16:29:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Jan 2008 16:29:56 -0000 Received: (qmail 7262 invoked by uid 500); 30 Jan 2008 16:29:41 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 7246 invoked by uid 500); 30 Jan 2008 16:29:41 -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 7235 invoked by uid 99); 30 Jan 2008 16:29:41 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Jan 2008 08:29:41 -0800 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of clinton.begin@gmail.com designates 72.14.252.155 as permitted sender) Received: from [72.14.252.155] (HELO po-out-1718.google.com) (72.14.252.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Jan 2008 16:29:13 +0000 Received: by po-out-1718.google.com with SMTP id c31so509722poi.1 for ; Wed, 30 Jan 2008 08:29:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:references:in-reply-to:subject:date:mime-version:content-type:x-mailer:thread-index:content-language:message-id; bh=KU15xWSJ24WnigVzmSUnTJUQUT97bAMmEfM5yqLcASo=; b=ZM1y1AhTyR1NZ6QuJOiRKHPsFgFD4yINmxH2TgtWuuUWGgxEr2bM6j0bw1ymBnk7nxKK/Q5+RZLJnCYwHHNia9EjI/rYQs1ix0wKBWhE66Jag6jRQJcWPB1rleSaxkd/ILZS4nKZoXiaOh9ljCE8B9+0T2kdwgHUyQ//LyTCZYI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:references:in-reply-to:subject:date:mime-version:content-type:x-mailer:thread-index:content-language:message-id; b=tyQwI4V39S0yJDLzzLeCE09nKSYUrDue3/XF6vQu9PD6bcNPky0DrChqdABbvGmDisXP9R1p2oc4/sDvxnNextTb59qMbd9W7E1mFNcOtpY3Znx4aZrUbctlqvJsyEWTHFvWP0nwmExygYjLZsHbxSy5xmXME+3Uqqt7gGwfGqg= Received: by 10.140.179.25 with SMTP id b25mr666223rvf.152.1201710560230; Wed, 30 Jan 2008 08:29:20 -0800 (PST) Received: from DARKSTAR ( [24.66.203.119]) by mx.google.com with ESMTPS id g22sm3151528rvb.5.2008.01.30.08.29.18 (version=SSLv3 cipher=OTHER); Wed, 30 Jan 2008 08:29:19 -0800 (PST) From: "Clinton Begin" To: References: In-Reply-To: Subject: RE: Safe to replace valueObject in RowHandler? Date: Wed, 30 Jan 2008 09:29:08 -0700 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_019B_01C86322.91885CD0" X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AchjXHpL5i8IJlYYQyywuh6ALti59gAAKJ6A Content-Language: en-ca Message-ID: <47a0a5df.16538c0a.0fa1.ffffcd2a@mx.google.com> X-Virus-Checked: Checked by ClamAV on apache.org This is a multipart message in MIME format. ------=_NextPart_000_019B_01C86322.91885CD0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Unfortunately that's not possible in Java, let alone with iBATIS. If you're just trying to create subclasses based on a type column in the database, look up "discriminator" in the ibatis documentation or mailing list archives... Clinton From: Hugh Ross [mailto:hh4ross@gmail.com] Sent: January-30-08 9:23 AM To: user-java@ibatis.apache.org Subject: Safe to replace valueObject in RowHandler? Trying to be more specific: Is it safe to create another object in the handleRow method, and set the valueObject to it? Is it safe to use queryForObject from within a handleRow method? I've seen other posts that imply it is. Will that object then replace the original one, if it was created by a queryForList or queryForObject call? If I don't hear back, I guess I'll try it to see... Thanks... On 1/29/08, Hugh Ross wrote: I have the good fortune to work on a large domain model, part of which uses too much inheritance. I don't want to use a huge outer join with 15 or 20 tables in it. I'm wondering if I can use RowHandlers to help. In particular, is it possible for a RowHandler to replace the object passed to the handleRow method? E.g., public void handleRow (Object valueObject) throws SQLException { Person person = (Person) valueObject; valueObject = MyFactory.createSubClassObject( person ); } Any other sample solutions to this kind of problem are also most welcome... ------=_NextPart_000_019B_01C86322.91885CD0 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Unfortunately that’s not possible in Java, let = alone with iBATIS. 

 

If you’re just trying to create subclasses based on = a type column in the database, look up “discriminator” in the = ibatis documentation or mailing list archives...

 

Clinton

 

From: Hugh Ross [mailto:hh4ross@gmail.com] =
Sent: January-30-08 9:23 AM
To: user-java@ibatis.apache.org
Subject: Safe to replace valueObject in = RowHandler?

 

 

Trying to be more specific:

 

Is it safe to create another object in the = handleRow method, and set the valueObject to it?

 

Is it safe to use queryForObject from within a = handleRow method?  I've seen other posts that imply it is.

 

Will that object then replace the original one, if = it was created by a queryForList or queryForObject call?  If I don't hear = back, I guess I'll try it to see...
 

Thanks...
 

On 1/29/08, Hugh = Ross <hh4ross@gmail.com> = wrote:

 

I have the good fortune to work on a large domain = model, part of which uses too much inheritance.  I don't want to use a = huge outer join with 15 or 20 tables in it.  I'm wondering if I can use = RowHandlers to help.  In particular, is it possible for a RowHandler to replace = the object passed to the handleRow method?

 

E.g.,

 

publ= ic void handleRow (Object valueObject)
   throws SQLException {
   Person person =3D (Person) valueObject;
   valueObject =3D MyFactory.createSubClassObject( person = );

}

Any other sample solutions to this kind of problem are also most = welcome...

&nbs= p;

 

------=_NextPart_000_019B_01C86322.91885CD0--