EntityManager.flush() does not behave properly with transient one-to-one association and no cascade

Description

According to JPA 2.1, section 3.2.4 (Synchronization to the Database)

"The semantics of the flush operation, applied to an entity X are as follows:
...
• For any entity Y referenced by a relationship from X, where the relationship to Y has not been annotated with the cascade
element value cascade=PERSIST or cascade=ALL
• If Y is new or removed, an IllegalStateException will be thrown
by the flush operation (and the transaction marked for rollback) or the transaction commit will fail."

Prior to fixing HHH-9330, EntityManager operated properly when the relationship to Y is one-to-one. After was fixed, IllegalStateException is no longer thrown when Y is new.

Activity

Show:

Former user January 15, 2015 at 1:52 AM

Fixed in master, 4.3, and 4.2 branches.

Former user January 14, 2015 at 7:20 PM

This fix will revert the fix in HHH-9330. The test case from will be marked as @FailureExpected.

After reverting, covers fixing the original issue in HHH-9330.

Martin Simka January 14, 2015 at 12:54 PM

Fixed

Details

Assignee

Reporter

Components

Affects versions

Priority

Created January 14, 2015 at 7:12 AM
Updated June 4, 2024 at 10:18 PM
Resolved January 15, 2015 at 1:52 AM