[ https://issues.apache.org/jira/browse/CAUSEWAY-3349?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andi Huber closed CAUSEWAY-3349. -------------------------------- > removeAndFlush fails if object was created persistAndFlush in the same > interaction. > ----------------------------------------------------------------------------------- > > Key: CAUSEWAY-3349 > URL: https://issues.apache.org/jira/browse/CAUSEWAY-3349 > Project: Causeway > Issue Type: Bug > Affects Versions: 2.0.0-M9 > Reporter: Daniel Keir Haywood > Assignee: Andi Huber > Priority: Major > Fix For: 2.0.0-RC1 > > Attachments: image-2023-02-05-14-38-36-722.png, > image-2023-02-05-14-40-06-590.png, image-2023-02-05-14-40-49-306.png, > image-2023-02-05-14-42-52-392.png, image-2023-02-05-14-43-23-084.png > > > This has happened in an integ test in Estatio, so I don't have a reproducible > case, but what the test did was to create an object using > repositoryService#persistAndFlush, and then in its teardown destroy it using > removeAndFlush. > However, what I observe is an assertion error. > !image-2023-02-05-14-38-36-722.png|width=840,height=415! > and a few frames up: > !image-2023-02-05-14-40-06-590.png|width=1826,height=814! > so, isVariantRemoved() is failing: > !image-2023-02-05-14-40-49-306.png! > because the managed object is actually instance of > `_ManagedObjectEntityHybrid`. > > My guess is the dnState of the pojo, namely P_NEW_DELETED, might be the issue. > I was able to workaround the error by changing the utility method > `removeWhenNotNull` from : > !image-2023-02-05-14-42-52-392.png! > to performing the remove in two passes: > !image-2023-02-05-14-43-23-084.png|width=667,height=353! > > > > > -- This message was sent by Atlassian Jira (v8.20.10#820010)