Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.0.0-M5
-
None
Description
For example, secman's ApplicationTenancy cannot be persisted as currently implemented.
Reason (perhaps): there is logic in ManagedObjects.EntityUtil.getState() to infer the entity state of the object, and for such entities it returns the state as PERSISTABLE_DESTROYED rather than DETACHED, meaning that flush transaction is never called.
To reproduce, simply attempt to create a new ApplicationTenancy.
HERE'S THE CODE THAT SHOWS the entity is not reported as detached,so the transaction never flushed:
THE FIX MIGHT BE TO SIMPLY REMOVE THE HIGHLIGHTED, WHICH PERHAPS IS A PERFORMANCE OPTIMISATION? (or, it is only safe to do if the @Id also has @GeneratedValue, which application-defined primary keys do not, of course.