Upgraded my Hibernate core from 6.5.2.Final to 6.6.0.Final and got this exception while trying to delete a record using repository method:
TransientObjectException
persistent instance references an unsaved transient instance of ‘com.thevegcat.app.entity.article.Article’ (save the transient instance before flushing)
The code of my app is the same and the only change is dependency upgrade previously mentioned.
When I look at the migration guide, there is no mention of transients.
Also I don’t understand the message because I expect transients not to be persisted if I had one, but the message asks me the opposite - to persist transients.
No matter my understaning or maybe better to say lack of understanding - I’m not sure is it a bug or a feature and the main question is should change my code to handle this new behaviour or not.
You’re probably being hit by a bugfix that took place in version 6.6.0 that involved transient-checks for deleted entities that are still referred to from associations of other entities in the persistence context.
You’re probably forgetting to null-out some association after deleting the target entity.