> How do I define a foreign key in my Torque schema with a one-to-one > mapping ? No matter what I do I always seem to end up with a one-to-many
> relationship ? There is no support on the java side for a one-to-one relationship (meaning that a one-to-one relationship is a special case as a one-to-many-relationship and the generated java code always reflects the more general one-to-many case) But you can write the code for a one-to-one relationship yourself: On the database side, a one-to-one relationship is a non-nullable foreign key column with a unique index on the foreign key column. All of this can be defined in the torque schema, e.g. as ... <column name="journeySetID" required="true"... /> <foreign-key foreignTable="styledJourneys"> <reference local="journeySetID" foreign="journeySetID"/> </foreign-key> <unique> <unique-column name="journeySetID"/> </unique> ... Then, as you know thatyou have enforced a one-to-one relation on the database side, you can refelct this knowledge on the java side by adding getters and setters to your java code which map the n side list to a 1 side simple getter and setter. Hope that helps, Thomas --------------------------------------------------------------------- To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org For additional commands, e-mail: torque-user-h...@db.apache.org