Re: many to many relations and default values for the association table?

From: Marc Guenther (yod..chli.ch)
Date: Mon Oct 04 2010 - 09:36:04 UTC

  • Next message: Marc Guenther: "Re: many to many relations and default values for the association table?"

    Hi all,

    On 30.09.2010, at 20:29, Mike Kienenberger wrote:
    > Normally, you just don't flatten those relationships if you need to
    > access (set/get) additional fields out of the join table.

    I guess that's what I will end up doing if the QueryBuilder stuff doesn't work out. Just thought there might be an easier way, as I don't really need those attributes, I only want to set them to some default.

    On 30.09.2010, at 19:55, Andrey Razumovsky wrote:
    > The easiest way is to set the default value at database level. If this way
    > doesn't work for you, here's Cayenne 3 solution, maybe a bit ugly, but the
    > one comes first to my mind:

    DB level would be the easiest, yes, but I don't really want to introduce such a dependency. The QueryBuilder stuff looks interesting, I will play around with that, and see how far I get.

    gilbertoca wrote:
    > When the association table has attributes, that means you relationship needs
    > an obj-entity to set/get those attributes (in your case: UserGroup)
    >
    > Using this design you can set default values to UserGroup. See this
    > discussion [1].

    No, that won't work, as the entry in the association table is created directly, without going through any of the obj-entity stuff. So, no callbacks or anything.

    Thanks,
    Marc



    This archive was generated by hypermail 2.0.0 : Mon Oct 04 2010 - 09:36:43 UTC