Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1182357

Summary: (6.3.z) [HHH-9568] EntityManager.flush() does not behave properly with transient one-to-one association and no cascade
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Carlo de Wolf <cdewolf>
Component: HibernateAssignee: Gail Badner <gbadner>
Status: CLOSED CURRENTRELEASE QA Contact: Martin Simka <msimka>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: cdewolf, gbadner, jawilson, msimka, rsvoboda, smarlow
Target Milestone: CR1   
Target Release: EAP 6.3.3   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1182334 Environment:
Last Closed: 2019-08-19 12:41:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1182334    
Bug Blocks: 1151405, 1182266    

Description Carlo de Wolf 2015-01-14 22:54:03 UTC
+++ This bug was initially created as a clone of Bug #1182334 +++

Description of problem:

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 HHH-9330 was fixed, IllegalStateException is no longer thrown when Y is new.

https://hibernate.atlassian.net/browse/HHH-9568

How reproducible: always

Steps to Reproduce:
See org.hibernate.jpa.test.cascade.CascadeTest.testFlushTransientOneToOne().

Actual results:
IllegalStateException is no longer thrown when Y is new.

Expected results:
An IllegalStateException will be thrown
by the flush operation (and the transaction marked for rollback) or the transaction commit will fail

Additional info:
This fix reverts https://bugzilla.redhat.com/show_bug.cgi?id=1182303 (https://hibernate.atlassian.net/browse/HHH-9330).

Comment 4 Martin Simka 2015-01-28 13:21:53 UTC
verified on EAP 6.3.3.CP.CR2