Bug 1182334 - (6.4.0) [HHH-9568] EntityManager.flush() does not behave properly with transient one-to-one association and no cascade
Summary: (6.4.0) [HHH-9568] EntityManager.flush() does not behave properly with transi...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Hibernate
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ER2
: EAP 6.4.0
Assignee: Gail Badner
QA Contact: Martin Simka
URL:
Whiteboard:
Depends On:
Blocks: 1182265 1182357
TreeView+ depends on / blocked
 
Reported: 2015-01-14 21:36 UTC by Gail Badner
Modified: 2019-08-19 12:43 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1182357 (view as bug list)
Environment:
Last Closed: 2019-08-19 12:43:32 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Gail Badner 2015-01-14 21:36:00 UTC
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 1 Martin Simka 2015-02-17 09:59:16 UTC
verified on EAP 6.4.0.ER2 (Hibernate 4.2.18.Final-redhat-1)


Note You need to log in before you can comment on or make changes to this bug.