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 Wed, 09 Apr 2008 12:01:30 GMT
Dear Thomas,

thanks for clearing out my doubts. The great problem was lot's of posts that
I've found on this subject that took me to think that torque was implemented for
explicity not suport comp-keys (many-to-many) mappings.

That's looked odd to me, and thanks to this list everything is clear now, torque
DOES support many-to-many mappings.


About my situation with personComittee mapping, unfortunatly I realized that
I was still working with 3.3RC2 release. I'm not sure if was a BUG on that
release, but with final-release 3.3RC3 that mapping worked perfect. I get right
SQL CREATE TABLE statements, and complete functional DataObjects and Peers.

I could arrange later the exactly code and errorLog that 3.3RC2 was giving to me
for this mapping, just tell me if you stay intersted.


Anyway, thanks again for helping me out.


Regards


Mario Caseiro

* Thomas Fischer (tfischer@apache.org) wrote:
> >>>
> >>><table name="personCommittee">
> >>><column
> >>>   name="IdComite"
> >>>   required="true"
> >>>   primaryKey="true"
> >>>   type="INTEGER"/>
> >>><column
> >>>   name="IdPerson"
> >>>   required="true"
> >>>   primaryKey="true"
> >>>   type="INTEGER"/>
> >>></table>
> 
> >>>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.
> 
> There is nothing wrong with your mapping, except that you should use 
> idMethod="none" for tables where you do not want or torque does not 
> support auto-generated primary keys (as in your mapping; auto-generation 
> of primary keys would not make sense). This is what you do with 
> auto-increment=none, but settinbg the defaultIdMethod is preferred 
> (because more db-independent).
> 
> >
> >Does torque really don't suport multiple-primary keys or there's some 
> >hidden
> >way for getting them work?
> >
> 
> I have mappings like yours working for me so composite primary keys are 
> definitely supported by torque. To work out why you run into problems, I'd 
> need some more information:
> 
> - what database are you using ?
> - Could you provide a simple code sample where you try to save a 
> PersonCommittee object ?
> 
>    Thomas
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
> 

---------------------------------------------------------------------
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