[hibernate-issues] [Hibernate-JIRA] Created: (HHH-6574) map-key-many-to-many and cascade="all-delete-orphan" do not work together

David Bray (JIRA) noreply at atlassian.com
Mon Aug 15 06:42:02 EDT 2011


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

                 Key: HHH-6574
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6574
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 3.6.6
         Environment: Hibernate 3.6.6 Final
Oracle 11.2.0.2.0
            Reporter: David Bray
            Priority: Blocker
         Attachments: hibtestcase.jar

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.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list