Return-Path: Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: (qmail 36964 invoked from network); 12 Apr 2011 20:14:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 12 Apr 2011 20:14:49 -0000 Received: (qmail 52568 invoked by uid 500); 12 Apr 2011 20:14:49 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 52547 invoked by uid 500); 12 Apr 2011 20:14:49 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 52538 invoked by uid 99); 12 Apr 2011 20:14:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Apr 2011 20:14:49 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [190.151.36.195] (HELO gondor.welinux.cl) (190.151.36.195) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Apr 2011 20:14:41 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by gondor.welinux.cl (Postfix) with ESMTP id C43225022DC for ; Tue, 12 Apr 2011 16:14:47 -0400 (CLT) X-Virus-Scanned: amavisd-new at welinux.cl Received: from gondor.welinux.cl ([127.0.0.1]) by localhost (gondor.welinux.cl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id H01KFnWSGV6A for ; Tue, 12 Apr 2011 16:14:47 -0400 (CLT) Received: from gondor.welinux.cl (localhost.localdomain [127.0.0.1]) by gondor.welinux.cl (Postfix) with ESMTP id 331BA5022B9 for ; Tue, 12 Apr 2011 16:14:47 -0400 (CLT) Date: Tue, 12 Apr 2011 16:14:47 -0400 (CLT) From: "Hans C. Poo" To: user@cayenne.apache.org Subject: Re: Mapping Question Message-ID: <6bbb7098-44ad-4d03-81b2-9a8944f4ffc5@gondor.welinux.cl> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-Originating-IP: [190.151.36.194] X-Mailer: Zimbra 7.1.0_GA_3140 (ZimbraWebClient - FF3.0 (Linux)/7.1.0_GA_3140) Tony, I had a similar problem and solved it making the relationship in the reverse sense of what composition dictates. First create NoteCollection that contains a Collection of Notes. Entities, Think Topic, Project, Category, Asset must have an "id_note_collection" field. Example: Project --> NoteCollection --> * Note Asset --> NoteCollection --> * Note Any Entity that needs a NoteCollection must have an noteCollectionId. Bye Hans ----- Mensaje original ----- De: "Tony Giaccone" Para: user@cayenne.apache.org Enviados: Martes, 12 de Abril 2011 16:43:49 Asunto: Mapping Question This is more of a generic question, though I'm interested in how it might be implemented in Cayenne as well. I have a number of entities, Think Topic, Project, Category, Asset. On each one I need to model a to many relationship to Notes, Where a Note is an object with a subject and a date created and content. I"m not sure what the best strategy is to map each of these different entities. I really don't want to create 4 note tables, So that there's a Topic Note table, and a Project Note table and well you get the idea. I could put a discriminator on the table, so that each entry has it's own "type" that would solve part of the problem, but they I have to create the foreign keys relationship. So I'm just looking for some advice. Have you dealt with a similar situation, and how did you model in general this solution and in Cayenne in particular. Thanks for the help Tony Giaccone