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 functio

Re: VARCHAR vs LONGVARCHAR vs CLOB

2020-09-08 Thread Hugi Thordarson
>> should I just define everything as VARCHAR and forget about it? > > Yes. CLOBs have some special handling, which is irrelevant for Postgres. Thanks, eliminated all those CLOBs and LONGVARCHARs and now it's just VARCHAR everywhere. Does wonders for my OCD :) - hugi >> On Sep 7, 2020, at 5

Re: DomainStoppedException: Domain project was shutdown...

2020-09-08 Thread Andrus Adamchik
Hi, This indicates that Cayenne was accessed after the stack shutdown. The only place that may happen in Bootique is when the entire app is stopped and ShutdownManager is called [1]. Also this should be an unrecoverable error, so after you see it once, all subsequent Cayenne operations would ke

Re: VARCHAR vs LONGVARCHAR vs CLOB

2020-09-08 Thread Andrus Adamchik
> should I just define everything as VARCHAR and forget about it? Yes. CLOBs have some special handling, which is irrelevant for Postgres. > On Sep 7, 2020, at 5:43 PM, Hugi Thordarson wrote: > > Hi all, > while looking further into migration to 4.2 I noticed my model has several > DbAttribu

Re: Programmatically adding (db/obj) attributes to a model and saving

2020-09-08 Thread Andrus Adamchik
Yeah, that's as good as it gets. ProjectLoader/Saver deal with multi-file projects. If you need to modidy a single existing DataMap, XMLEncoder is what you need. Andrus > On Sep 6, 2020, at 12:25 PM, Hugi Thordarson wrote: > > Well that's no fun when you have this nice purpose-build API right

DomainStoppedException: Domain project was shutdown...

2020-09-08 Thread Alexander Zapasnik
Hello everyone. I have a bootique application which uses a 5 minute cron job to update DB via some rules. I've noticed that sometimes it throws DomainStoppedException. It is hard to reproduce it as it happens just a few times per day. I can't get why this might happen. Any thoughts? org.apache.c