Using merge and persist in the same transaction with related entities

I have a question about the behavior of persist and merge when there are 1 to many high level dependency relationships, let’s say I have an entity called “cinema” and its children are the “movie theater”, when I update the cinema (I do a merge) for example its income increased, but at the same time a new movie theater was created, an object that I create and as I am creating it I link it to its parent entity (“cinema”) and I create it (I do persist), then I execute the flush and the commit, the cinema changes are updated but the new movie theater entity is not, what is the reason for this? Is it some particularity of the use of persist that is overwritten when doing a merge?

I must clarify that this does not happen when I do a merge to the parent entity and the merge is also received by the child entity by cascade and during its management I do not persist

I don’t see why persisting the related entity first would cause it to not be saved during flush, so this sounds like a bug. What version of Hibernate are you using? It would be great if you could try to create a reproducer with our test case template and if you are able to reproduce the issue, create a new ticket in our issue tracker and attach that reproducer.

I am using version 6.6.4, and I will build the test case to report the possible bug