You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Fredrik Liden <fl...@translate.com> on 2008/05/02 21:14:13 UTC

Datamodel advice

Hi, I'm wondering what is the best way to implement this structure in
Cayenne:

Let's say there is a list of users assigned to a client:
m:n between USER (userid) and CLIENT (clientid) and between CLIENT_USER
(userid,clientid) is the flattened table.

Now from that list of users in CLIENT_USER I want to one and assign to
say a certain languages. I believe the correct datamodel would be:

m:n between CLIENT_USER (userid,clientid) and LANGUAGE (languageid)
where ASSIGNMENT (userid,clientid,languageid) would be the between
(flattened) table.
 
Is it possible to have a flattened table (ASSIGNMENT) based on another
flattened table (CLIENT_USER)? Or should I unflatten CLIENT_USER and add
a cayenne generated id so it would be
CLIENT_USER(client_userid,userid,clientid) and ASSIGNEMENT
(client_userid,languaged) would be flattened.
I find that I'm often coming back to this situation so just wondering if
anyone has any suggestions.

Thanks,
Fredrik