Re: Deleting ObjEntity with flattened attribute
"Jurgen Doll" <[email protected]> Tue, 07 May 2024 19:00:36 +0200
| Newsgroups | gmane.comp.java.cayenne.devel |
|---|---|
| Organization | iVory EMR |
| Message-ID | <op.2neuvaowy9kazd@admin-pc> |
Hi Nikita I've submitted a PR to fix the issue and the test case. I did have a look at using trackedFlattenedPaths as you suggested but preventing a flattened attribute from being added then also prevents any updates to those attributes from being properly committed. So I had to use an alternative method. Thanks, regards Jurgen On Mon, 06 May 2024 16:22:48 +0200, Nikita Timofeev <[email protected]> wrote: > Hi Jurgen, > > Yeah, this seems like a problem here, thanks for finding it. > > Delete part is indeed intended behavior and introduced some time ago (I'm > not quite sure when), > and Cayenne 4.2 had a significant refactoring that altered the overall > logic of flattened relationships. > The idea here is that the main object tracks and manages all related > flattened objects, otherwise they could just clutter the DB. > > So reverting to a 3.1 logic is not an option here unfortunately. > > We could (and probably should) get smarter logic that decides if we need > to > delete a flattened row. > Looking at the code, we may need to change not the delete part, but > rather > the tracking part (e.g. what goes to the > ObjectStore.trackedFlattenedPaths) > > Would be great if you could provide a test case for this.