cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Guenther <y...@schli.ch>
Subject Re: many to many relations and default values for the association table?
Date Mon, 04 Oct 2010 11:00:12 GMT
Hi,

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:
> you can intercept low-level SQL query generation by
> implementing BatchQueryBuilderFactory (extending
> DefaultBatchQueryBuilderFactory). There you can plug your own
> InsertBatchQueryBuilder that will set certain fields for certain
> tables. BatchQueryBuilderFactory can be set via
> DataDomain.setQueryBuilderFactory.

I have done this:
  ((DataContext) context).getParentDataDomain().setQueryBuilderFactory(new MyBatchQueryBuilderFactory());
which in turn sets a MyInsertBatchQueryBuilder.

Unfortunately, that is only called for inserts into the group and user db_entities, but not
for the join table.

Marc


Mime
View raw message