Consider throwing UnsupportedOperationException when a bytecode-enhanced entity's clone method is called

Description

When a bytecode-enhanced entity is cloned, both the original and clone have references to the same enhanced fields. This can result in unexpected behavior.

For example, Hibernate will use the same EntityEntry for both the original and clone because the enhanced getter $$_hibernate_getEntityEntry() for both entities will return the same EntityEntry object.

If the application attempts to delete the original entity, and set a different ID in the clone to persist, Hibernate will attempt to "resurrect" the deleted entity, but will throw an exception because there is no "delete" action scheduled for the clone.

Activity

Details

Assignee

Reporter

Components

Fix versions

Priority

Created September 11, 2018 at 11:40 PM
Updated December 17, 2018 at 11:58 AM

Flag notifications