map-key-many-to-many and cascade="all-delete-orphan" do not work together

Description

It seems that if you have maps keyed by entities, they do not respect the cascade options. The attached test case shows this working for Map<String, Entity> but failing for Map<Entity, String> and Map<Entity, Entity> with 'object references an unsaved transient instance'.

The problem seems to be caused by the code treating maps as single type collections. As an example, calling getCollectionPersistor from Cascade for the Map<Entity, String> returns a BasicCollectionPersistor for String. The element type for the persistor is then claimed to be String and any cascading which should be performed on the key is ignored.

To pre-empt a solution I suspect will be proposed, I can't use nested components as the map keys as the objects these entities will represent in our system tend to be complex, self-referential hierarchies of arbitrary depth.

Environment

Hibernate 3.6.6 Final
Oracle 11.2.0.2.0

Activity

Show:
Brett Meyer
April 7, 2014, 5:48 PM

In an effort to clean up, in bulk, tickets that are most likely out of date, we're transitioning all ORM 3 tickets to an "Awaiting Test Case" state. Please see http://in.relation.to/Bloggers/HibernateORMJIRAPoliciesAndCleanUpTactics for more information.

If this is still a legitimate bug in ORM 4, please provide either a test case that reproduces it or enough detail (entities, mappings, snippets, etc.) to show that it still fails on 4. If nothing is received within 3 months or so, we'll be automatically closing them.

Thank you!

d
April 8, 2014, 8:00 AM

I must admit to being slightly confused by two things. The first is why I wasn't notified of the status change to 'Awaiting Test Case'. The second is why it ever entered that status since there is a test case attached in a jar called 'hibtestcase.jar'. It may be the case that the test-case is somewhat out-of-date since it has been festering here for the last three years without anybody paying it any attention but can somebody please at least try to execute the testcase and see if there's still a problem.

Kind regards,
Dave.

Brett Meyer
April 8, 2014, 1:58 PM

Hi , the blog post [1] explains what we're trying to do. Notifications should have gone out for the comment I left (and it appears you got it), but we didn't send another notification for the status change simply for the sake of not spamming the heck out of everyone.

Have you tried your test case on ORM 4? That's what we be most helpful – confirmations that issues still exist.

[1] http://in.relation.to/Bloggers/HibernateORMJIRAPoliciesAndCleanUpTactics

Steve Ebersole
October 27, 2015, 7:17 PM

This bug report does not indicate that the reported issue affects version 5.x. Versions prior to 5.x are no longer maintained. It would be a great help to the Hibernate team and community for someone to verify that the reported issue still affects version 5.x. If so, please add the 5.x version that you verified with to the list of affected-versions and attach the (preferably SSCCE) test case you used to do the verification to the report; from there the issues will be looked at during our triage meetings.

For details, see http://in.relation.to/2015/10/27/great-jira-cleanup-2015/

Steve Ebersole
October 28, 2015, 3:26 AM

As part of verifying that this issue affects 5.0, please just set the "Affects version". Leave the "verify-affects-5.0" label and leave the issue in "Awaiting Response" status; these are critical for us to be able to track these verifications and triage them. Thanks.

Assignee

Unassigned

Reporter

d

Fix versions

None

Labels

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Blocker
Configure