Return-Path: Delivered-To: apmail-db-torque-user-archive@www.apache.org Received: (qmail 28623 invoked from network); 8 Apr 2008 14:00:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Apr 2008 14:00:15 -0000 Received: (qmail 20875 invoked by uid 500); 8 Apr 2008 14:00:15 -0000 Delivered-To: apmail-db-torque-user-archive@db.apache.org Received: (qmail 20858 invoked by uid 500); 8 Apr 2008 14:00:15 -0000 Mailing-List: contact torque-user-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Apache Torque Users List" Reply-To: "Apache Torque Users List" Delivered-To: mailing list torque-user@db.apache.org Received: (qmail 20847 invoked by uid 99); 8 Apr 2008 14:00:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Apr 2008 07:00:15 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mario.caseiro@gmail.com designates 209.85.132.244 as permitted sender) Received: from [209.85.132.244] (HELO an-out-0708.google.com) (209.85.132.244) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Apr 2008 13:59:32 +0000 Received: by an-out-0708.google.com with SMTP id c8so534674ana.45 for ; Tue, 08 Apr 2008 06:59:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:subject:message-id:references:mime-version:content-type:content-disposition:in-reply-to:user-agent; bh=UjUkuloTxzWst/9a5NLE01pITiu9xx7YcgsjwAOl+18=; b=LmpOc9r0ZhZuapt0Tq2Rt2LUejUerRuXrnfwhPysNJB/RrO+kLZc7cHhinip43LU03Fp81R3NVf9qUrhQo4PEWONnnlAxX8tmta05J6ao4ZKgGNIsQdml02xYwabURum70z6U+E58VRvqrEW9ygY/4Ccr9q9eVPJ04tIGHVygW0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:subject:message-id:references:mime-version:content-type:content-disposition:in-reply-to:user-agent; b=fIiyd0HZk/LQuIcy2+4ZNiAVf1IDYruO0A9WcSw74h88I4aCfG6Q4Xf+XD9AHOcE6H5ZucZBXOGgck/gYLMZB5kDXMvmyjVNwFjaX3PXLvuRhMOcD4YzMCJ5AI/GCGjJVVTqOvcOJVndE8VzDfAjgaB/ZMwFSv4TG8WKNSefbgM= Received: by 10.100.253.12 with SMTP id a12mr11927856ani.9.1207663184096; Tue, 08 Apr 2008 06:59:44 -0700 (PDT) Received: from localhost ( [189.19.222.205]) by mx.google.com with ESMTPS id d34sm21112969and.8.2008.04.08.06.59.37 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 Apr 2008 06:59:42 -0700 (PDT) Date: Tue, 8 Apr 2008 10:59:32 -0300 From: Mario Caseiro To: Apache Torque Users List Subject: Re: Multiple Primary-keys - many-to-many (Again?) Message-ID: <20080408135932.GB2988@localhost> References: <20080407181613.GD9702@localhost> <30f92e840804080326r4615baa1mec8b167df1e0ea73@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <30f92e840804080326r4615baa1mec8b167df1e0ea73@mail.gmail.com> User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Checked: Checked by ClamAV on apache.org First, thanks for replying my question ;) Unfortunaly that's exactly the workaround that I'm avoiding, I really don't get why not support composite-keys... I'm mean, composite-keys for many-to-many makes lots of sense to me, the database should be able to handle and protect by it self the exceptions of inserting duplicate objects (or relations of objects). That's what a composite-keys gives us, there's no way of duplicate relation be inserted on the database. By not supporting comp-keys, you must bring this control to the application... Does torque really don't suport multiple-primary keys or there's some hidden way for getting them work? If that's the truth (TORQUE DON'T SUPPORT COMP-KEYS), was by some dificults on implementation or tools used like 'village'... OR was the extremist concept of MUST HAVE SEQUENCE KEY ALLWAYS, NO COMP-KEYS, DOWN TO COMP-KEYS NOW!!! thinking ???? Once again, thanks for the reply Looking forward Mario Caseiro * Anas Mughal (anasmughal@gmail.com) wrote: > Could you have a primary ID for the table. > That is how I went about avoiding composite primary keys. > > Then, the many-to-many join would join with the primary ID instead of a > composite key. > > Would that work for you? > > > > On Mon, Apr 7, 2008 at 2:16 PM, Mario Caseiro > wrote: > > > Dear fellows, > > > > I have a big intuition that most of you guys should have some point in the > > past > > debated and answered this question already, but after days and days > > looking and > > seeking for some answer on the internet, I'm still without a solution. > > > > The question is: > > > > How torque handles and deals with many-to-many relations? > > > > > > I'm aware of lots of comments about many-to-many in torque, things from: > > "You must have one primary-key and the others should be unique instead of > > primary" > > > > to thins like: > > "It's perfectly possible have many-to-many relations like: > > > > > > > name="IdComite" > > required="true" > > primaryKey="true" > > type="INTEGER"/> > > > name="IdPerson" > > required="true" > > primaryKey="true" > > type="INTEGER"/> > >
> > > > " > > > > I understand the point of "Primary keys" in "Design considerations" of the > > project web-site. (For every table, you should create a primary key which > > has no > > meaning in real life.) > > > > But there's a lot of cases that you really NEED or WANT to user multiple > > PK's. > > > > > > Like in this case that I'm stucked, I really need a many-to-many > > relationship, > > there's no way of workarounds or changeing tables structures. > > > > > > What should I do? Accept the ridiculous argueing that Hibernate is better > > because it have many-to-many relationship support? > > > > > > In that mapping above, I can make it work, but only for retrieving > > objects. > > It works perfectly hidrating the objects, no problem at all. > > > > But I can not create a new object, by the time of .save() method, It > > raises an > > exception of "Criteria has nothing to insert", it's something saying that > > the > > criteria was empty, and so on nothing is inserted/saved into database. > > > > > > What you guys could say me about multiple PK's in torque, what's wrong on > > this > > mapping and what would be the dificulties of implementing in Torque > > many-to-many > > relations since it already works for retrieving objects with multiple > > PK's? > > > > > > > > ps: Just for records, the mapping above genarates wrong SQL CREATE TABLE > > Syntax, > > since the default on genarator for primaryKey is add and "AUTO_INCREMENT" > > statement, > > if you set those columns autoIncrement="false" than it generates right DDL > > for that > > table. > > > > > > > > > > Thanx in advance > > > > > > Mario Caseiro > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org > > For additional commands, e-mail: torque-user-help@db.apache.org > > > > > > > -- > Anas Mughal --------------------------------------------------------------------- To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org For additional commands, e-mail: torque-user-help@db.apache.org