Bug 1182354 - (6.3.z) [HHH-9330] orphanRemoval=true does not work in bidirectional relationships (without cascading)
Summary: (6.3.z) [HHH-9330] orphanRemoval=true does not work in bidirectional relation...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Hibernate
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: CR1
: EAP 6.3.3
Assignee: Gail Badner
QA Contact: Martin Simka
URL:
Whiteboard:
Depends On: 1182303
Blocks: eap633-payload 1159890
TreeView+ depends on / blocked
 
Reported: 2015-01-14 22:45 UTC by Carlo de Wolf
Modified: 2015-01-21 21:39 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 1182303
Environment:
Last Closed: 2015-01-21 21:39:56 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Carlo de Wolf 2015-01-14 22:45:32 UTC
+++ This bug was initially created as a clone of Bug #1182303 +++

Description of problem:

@Entity
public class Product {
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private Long id;

	@OneToMany(mappedBy = "product", orphanRemoval = true)
	private List<Feature> features = new ArrayList<Feature>();
	...
}

@Entity
public class Feature { 
	@Id 
	@GeneratedValue(strategy=GenerationType.AUTO) 
	private Long id; 

	@ManyToOne() 
	private Product product;
	...
}

This affects EntityManager only. 

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

How reproducible: easy to reproduce.

Steps to Reproduce:
See the tests in org.hibernate.ejb.test.orphan.onetomany.DeleteOneToManyOrphansTest for details.

Actual results:
Clearing the collection of features in the Product will not result in deleting all Features of that product.

Expected results:
Features that were cleared should be deleted.

Additional info:

The workaround is setting the CascadeType.PERSIST in the Product entity.

Tests (which work properly) for Hibernate core are in org.hibernate.test.orphan.onetomany.DeleteOneToManyOrphansTest.

--- Additional comment from Gail Badner on 2015-01-14 21:55:56 CET ---

This was fixed in 4.2.17.Final.


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