You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by mailinglist <ma...@ngong.de> on 2012/01/08 00:34:22 UTC

new to cayenne

I successfully re-engineered a database.

Now I like to insert a record into a table that has a primary key of two 
columns: one integer that is actually a foreign key and a Date value.

Is there somewhere an example similar to my task?

Thank you for your help.

Kind regards


Rolf

Re: new to cayenne

Posted by Andrus Adamchik <an...@objectstyle.org>.
Hi Rolf,

For FK column, map a relationship from another table, and check "To Dep PK" for that relationship [1]. This will ensure that the value of PK column that is also an FK will be set from the related PK. 

For the Date PK column, map it as an ObjAttribute and set it yourself as you would set any other object property.

Cheers,
Andrus


[1] http://cayenne.apache.org/doc30/to-dep-pk-checkbox.html 

On Jan 8, 2012, at 2:34 AM, mailinglist wrote:

> I successfully re-engineered a database.
> 
> Now I like to insert a record into a table that has a primary key of two columns: one integer that is actually a foreign key and a Date value.
> 
> Is there somewhere an example similar to my task?
> 
> Thank you for your help.
> 
> Kind regards
> 
> 
> Rolf
>