Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 36418 invoked from network); 9 Jul 2006 05:53:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 9 Jul 2006 05:53:01 -0000 Received: (qmail 34964 invoked by uid 500); 9 Jul 2006 05:53:00 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 34951 invoked by uid 500); 9 Jul 2006 05:52:59 -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 34940 invoked by uid 99); 9 Jul 2006 05:52:59 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 08 Jul 2006 22:52:59 -0700 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of j2eedodo@gmail.com designates 64.233.166.177 as permitted sender) Received: from [64.233.166.177] (HELO py-out-1112.google.com) (64.233.166.177) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 08 Jul 2006 22:52:58 -0700 Received: by py-out-1112.google.com with SMTP id o67so977976pye for ; Sat, 08 Jul 2006 22:52:37 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:from:to:subject:date:mime-version:content-type:x-priority:x-msmail-priority:x-mailer:x-mimeole; b=f0C3UAOxXu9gyTRjMhq5uv68Jw50gFkDFGsWrrXb48WwPqeuhVXnG2bcmltBrMVozZNE75nvcBrG/QXrxNsCYxkxmQyyxK97fFh+RUfqeRe0kLwgaobezHEZS78w+cffdxoL9V+nNyVtsM2Q8wMC5/TnkxkD9ey+QJpCw4Gn89g= Received: by 10.35.41.14 with SMTP id t14mr3853029pyj; Sat, 08 Jul 2006 22:52:37 -0700 (PDT) Received: from spring ( [222.155.98.216]) by mx.gmail.com with ESMTP id t5sm1784610pyc.2006.07.08.22.52.35; Sat, 08 Jul 2006 22:52:37 -0700 (PDT) Message-ID: <005301c6a31b$e7e3fa80$0401a8c0@spring> From: "Dodo" To: Subject: many-to-many relationship practice Date: Sun, 9 Jul 2006 17:52:44 +1200 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0050_01C6A380.7AEFB8F0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2869 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N This is a multi-part message in MIME format. ------=_NextPart_000_0050_01C6A380.7AEFB8F0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi ibatiser, Just a simple question on the general practice of implementing = many-to-many relationship in ibatis. I have a category object that can have many item, an item can belong to = many category, hence many-to-many relationship. So I introduced an association class named = CategorizedItem between them. Now what's the standard or prefered way of implementing this as below, 1. Add CategorizedItem to ArryList of Category, then call = CategoryDao.saveCategory( category.getCategorizedItems() ); where category.getCategorizedItems() simply return the ArrayList of = CategorizedItem. =20 Within CategoryDao.saveCategory(), CategorizedItem and Item will then = be saved to database or 2. Add Item to ArryList of Category, then call CategoryDao.saveCategory( = category.getItemsList() ); where category.getItemsList() simply return the ArrayList of Item.=20 Within CategoryDao.saveCategory(), CategorizedItem and Item will be = saved to database Currently I am going with approach 1. but I suddenly think why shud user = handle or know about the association class=20 CategorizedItem explicitly by adding CategorizedItem to ArryList of = Category?=20 I can't help thinking maybe I am making a big mistake in my design and = shud go with approach 2 instead. Any advice wud be greatly appreciated Thanks, Samuel ------=_NextPart_000_0050_01C6A380.7AEFB8F0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
 
Hi ibatiser,
 
Just a simple question on the general = practice of=20 implementing many-to-many relationship in ibatis.
 
I have a category object that can have = many item,=20 an item can belong to many category, hence
many-to-many relationship. So I = introduced an=20 association class named CategorizedItem between
them.
 
 
Now what's the standard or prefered way = of=20 implementing this as below,
 
 
1. Add CategorizedItem to ArryList of = Category,=20 then call CategoryDao.saveCategory( category.getCategorizedItems()=20 );
   where = category.getCategorizedItems()=20  simply return the ArrayList of CategorizedItem.  =
 
  =20 Within CategoryDao.saveCategory(), CategorizedItem and Item will = then be=20 saved to database
 
or
 
2. Add Item to ArryList of Category, = then call=20 CategoryDao.saveCategory( category.getItemsList() );
   where = category.getItemsList()=20 simply return the ArrayList of Item.
 
  =20 Within CategoryDao.saveCategory(), CategorizedItem and Item = will be=20 saved to database
 
 
Currently I am going with approach 1. but I suddenly think why shud = user=20 handle or know about the association class
CategorizedItem explicitly by adding CategorizedItem to ArryList of = Category?
 
I can't help thinking maybe I am making a big mistake in = my design and=20 shud go with approach 2 instead.
 
Any advice wud be greatly appreciated
 
Thanks,
 
Samuel
------=_NextPart_000_0050_01C6A380.7AEFB8F0--