Re: Cayenne 4.2—Modifying SQL generation to always use COALESCE when updating a certain column

2020-09-14 Thread Hugi Thordarson
First glance at that API looks real nice, I'm going to check this out, thanks :) - hugi > On 11 Sep 2020, at 07:06, Andrus Adamchik wrote: > > 4.2 for the first time exposes generated SQL as an AST, so tweaking it has > become much easier. This is the feature that made possible to support >

Re: Cayenne 4.2—Modifying SQL generation to always use COALESCE when updating a certain column

2020-09-11 Thread Andrus Adamchik
4.2 for the first time exposes generated SQL as an AST, so tweaking it has become much easier. This is the feature that made possible to support geospatial and JSON types. Nikita, please correct me if I am wrong with the following instructions (as this API is still in flux). So.. To customize

Re: Cayenne 4.2—Modifying SQL generation to always use COALESCE when updating a certain column

2020-09-08 Thread Hugi Thordarson
Thanks John, not a bad idea. I'd prefer it if the current method ports though (since I'd have to create triggers for something like 200 columns). But if that isn't possible we might consider this. - hugi > On 8 Sep 2020, at 20:33, John Huss wrote: > > Since you are already at the DB level

Re: Cayenne 4.2—Modifying SQL generation to always use COALESCE when updating a certain column

2020-09-08 Thread John Huss
Since you are already at the DB level (outside of cayenne) making this change, I would just use a BEFORE UPDATE row-level trigger in Postgres. You can change the value there. Something like this would work: CREATE OR REPLACE FUNCTION company_default() RETURNS trigger AS $$ BEGIN

Cayenne 4.2—Modifying SQL generation to always use COALESCE when updating a certain column

2020-09-08 Thread Hugi Thordarson
Working with old DB designs really results in the weirdest questions… So… I've been working around a design problem in a customer DB by using my own BatchTranslatorFactory. The functionality was that if a column is called "company", every update wraps the column's new value in a coalesce