cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Guenther <>
Subject Re: many to many relations and default values for the association table?
Date Mon, 04 Oct 2010 09:36:04 GMT
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

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.


View raw message