db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mario Caseiro <mario.case...@gmail.com>
Subject Re: Multiple Primary-keys - many-to-many (Again?)
Date Tue, 08 Apr 2008 13:59:32 GMT
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 <mario.caseiro@gmail.com>
> 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:
> >
> > <table name="personCommittee">
> > <column
> >    name="IdComite"
> >    required="true"
> >    primaryKey="true"
> >    type="INTEGER"/>
> > <column
> >    name="IdPerson"
> >    required="true"
> >    primaryKey="true"
> >    type="INTEGER"/>
> > </table>
> >
> > "
> >
> > 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


Mime
View raw message