Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 57634 invoked from network); 27 Apr 2010 08:18:12 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 27 Apr 2010 08:18:12 -0000 Received: (qmail 98306 invoked by uid 500); 27 Apr 2010 08:18:11 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 98192 invoked by uid 500); 27 Apr 2010 08:18:11 -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 98176 invoked by uid 99); 27 Apr 2010 08:18:10 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Apr 2010 08:18:10 +0000 X-ASF-Spam-Status: No, hits=4.4 required=10.0 tests=FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of joshnet2030@gmail.com designates 209.85.161.53 as permitted sender) Received: from [209.85.161.53] (HELO mail-fx0-f53.google.com) (209.85.161.53) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Apr 2010 08:18:03 +0000 Received: by fxm1 with SMTP id 1so188011fxm.12 for ; Tue, 27 Apr 2010 01:17:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=S/bU8oi5420XzU08SUjyEtiNhtrYCN2uZ3uQuuQOYdY=; b=u83ltAZZ3Xc3LH13Od0PMvTZo1rY3Sez8jLvoypRZQfuusggonOKDX7JOYadOJygTY 9cf3Wxjq3d/qemwLbisd8MVYwXwlM8qXf+SpQ7G3AyDeNrGXO6IR4mTnd1YZUmOhMrJM 6+RQ0eHe/O1WXLJMWW2a2CiH1PE1E3t+BxgLY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=tWfUKUdW358CpoGJc3pcbOU+V5HHlfnGcQ+cSqHHR+yz99t5QZOyx9Oxhism7U1BrP EEXHsyylc0hFb2paqN3OGXw/xiWIjCrcg4Y6qYcEpz4T8UaFk5ahGfmp8FoN/9ESv1ku pu4Xf4modNGhDnElIWXcyY8nh/snV8C7vnopk= MIME-Version: 1.0 Received: by 10.87.76.7 with SMTP id d7mr2013527fgl.65.1272356263251; Tue, 27 Apr 2010 01:17:43 -0700 (PDT) Received: by 10.223.113.81 with HTTP; Tue, 27 Apr 2010 01:17:43 -0700 (PDT) In-Reply-To: <4BD5CB12.8030303@burntmail.com> References: <4BD5CB12.8030303@burntmail.com> Date: Tue, 27 Apr 2010 11:17:43 +0300 Message-ID: Subject: Re: Domain modeling From: Josh Kamau To: user-java@ibatis.apache.org Content-Type: multipart/alternative; boundary=001485f8702819561e0485338770 X-Virus-Checked: Checked by ClamAV on apache.org --001485f8702819561e0485338770 Content-Type: text/plain; charset=ISO-8859-1 Thanks for the reply. How about cases where the type is not an enum. In my example, lets say the UserType is not an enum but a Bean On Mon, Apr 26, 2010 at 8:19 PM, Guy Rouillier wrote: > We addressed this issue by creating enums for the type columns, then > creating a type handler to map from the column value to the enum and vice > versa. In addition to the programming benefits of working with enums, you > also let iBATIS handle the translations for both select and insert. > > > On 4/26/2010 9:42 AM, Josh Kamau wrote: > >> Hi team; >> >> I am working on the domain model for a project. I have a class named >> user that has a class named UserType as one of the properties. I know >> when i want to select all users, i will use joins to pick up all >> corresponding usertypes. How do i do inserts? Do i have to write a >> handler for userType? or can i do something like >> >> INSERT INTO users(... usertype_id ...) VALUES(.. >> #{usertype.usertype_id}...) >> >> Please help; >> >> I have spent the whole day trying to figure this out. Am using ibatis >> 3.0 and am new to ibatis. >> >> Regards >> Josh >> > > > -- > Guy Rouillier > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org > For additional commands, e-mail: user-java-help@ibatis.apache.org > > --001485f8702819561e0485338770 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thanks for the reply.

How about cases where the type is = not an enum. In my example, lets say the UserType is not an enum but a Bean=

On Mon, Apr 26, 2010 at 8:19 PM, Guy Rou= illier <guyr= -ml1@burntmail.com> wrote:
We addressed this issue by creating enums f= or the type columns, then creating a type handler to map from the column va= lue to the enum and vice versa. =A0In addition to the programming benefits = of working with enums, you also let iBATIS handle the translations for both= select and insert.


On 4/26/2010 9:42 AM, Josh Kamau wrote:
Hi team;

I am working on the domain model for =A0a project. I have a class named
user that has a class named UserType as one of the properties. I know
when i want to select all users, i will use joins to pick up all
corresponding usertypes. How do i do inserts? Do i have to write a
handler for userType? or can i do something like

=A0 =A0INSERT INTO users(... usertype_id ...) VALUES(..
#{usertype.usertype_id}...)

Please help;

I have spent the whole day trying to figure this out. Am using ibatis
3.0 and am new to ibatis.

Regards
Josh


--
Guy Rouillier

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


--001485f8702819561e0485338770--