Thank you very much Andrus, but your solution doesn't work. I still believe that is a debug of cayenne.
To do that you've said me: * To allow the Cayenne modeler check "to dep Pk" in the relationship slave_table (ENCLOSURE) --> master_table (USE), I need before check the FK (CD_USE) in the slave_table, and so I can alredy select the check "to dep Pk". But now i've another problem. I use Cayenne-Generated Primary Key, and when I generate a new CayenneDataObject() type Enclosure: > 1. Create and register a new Enclosure object in our Cayenne DataContext. > > 2. Retrieve from the database an “Use” DataObject, an setUse in the > Enclosure Object > > 3. Retrieve from the database an “PieceOfGround” DataObject and > setPieceOfGround in the Enclosure Objet. I get this error: org.apache.cayenne.CayenneRuntimeException: [v.3.0.2 Jun 11 2011 09:26:09] Primary Key autogeneration only works for a single attribute. ... Before do this changes I expected that error because the pk autogeneration only works wiht single values..... I still think that is a cayenne problem or bug, because it doesn't allows to have a fk to a unique field, must always be to a pk field :-( > >