[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-5534) Regression in 3.5.5: Cascade on merge for Sets fails with transient entities

Gail Badner (JIRA) noreply at atlassian.com
Tue Sep 7 13:58:18 EDT 2010


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5534?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gail Badner updated HHH-5534:
-----------------------------

       Assignee: Gail Badner
    Description: 
Something happened from 3.5.4 to 3.5.5. Here is regression issue we're experiencing after upgrade:

We have entities ResearchClientFile and ResearchVendorRecord.

RCF maps RVR:

@Sort(type = SortType.NATURAL)
    @OneToMany(mappedBy = "file", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
    public SortedSet<ResearchVendorRecord> getRecords() {
        return records;
    }

RVR maps RCF:

@ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(name = "research_client_file_id")
    public ResearchClientFile getFile() {
        return file;
    }

The following unit test:

ResearchClientFile rcf = RandomUtils.randomBean(ResearchClientFile.class);
rcf.addRecord(RandomUtils.randomBean(ResearchVendorRecord.class));
rcf = session.merge(rcf);

produces the following exception in 3.5.5 but not in 3.5.4.:

java.lang.NullPointerException: null entities are not supported by org.hibernate.event.def.EventCache
	at org.hibernate.event.def.EventCache.containsKey(EventCache.java:80)
	at org.hibernate.event.def.DefaultMergeEventListener.mergeTransientEntity(DefaultMergeEventListener.java:361)
	at org.hibernate.event.def.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:303)
	at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:258)
	at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:869)


equals, hashCode and compareTo are completely consistent in RVR. 

The issue seems to affects only Set and SortedSets and on merge only. Lists (with bag semantics) do not appear to be affected on merge.

  was:
Something happened from 3.5.4 to 3.5.5. Here is regression issue we're experiencing after upgrade:

We have entities ResearchClientFile and ResearchVendorRecord.

RCF maps RVR:

@Sort(type = SortType.NATURAL)
    @OneToMany(mappedBy = "file", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
    public SortedSet<ResearchVendorRecord> getRecords() {
        return records;
    }

RVR maps RCF:

@ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(name = "research_client_file_id")
    public ResearchClientFile getFile() {
        return file;
    }

The following unit test:

ResearchClientFile rcf = RandomUtils.randomBean(ResearchClientFile.class);
rcf.addRecord(RandomUtils.randomBean(ResearchVendorRecord.class));
rcf = session.merge(rcf);

produces the following exception in 3.5.5 but not in 3.5.4.:

java.lang.NullPointerException: null entities are not supported by org.hibernate.event.def.EventCache
	at org.hibernate.event.def.EventCache.containsKey(EventCache.java:80)
	at org.hibernate.event.def.DefaultMergeEventListener.mergeTransientEntity(DefaultMergeEventListener.java:361)
	at org.hibernate.event.def.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:303)
	at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:258)
	at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:869)


equals, hashCode and compareTo are completely consistent in RVR. 

The issue seems to affects only Set and SortedSets and on merge only. Lists (with bag semantics) do not appear to be affected on merge.

Of all the things touch in 3.5.5 (according to the changelog) this issue seems to be the only one dealing with merge functionality, so I decided to put a comment here. I will also create a bug that described this in detail.


Kyrill, thanks for reporting this. I'll look into this. Also, I've removed the last paragraph from the description.

> Regression in 3.5.5: Cascade on merge for Sets fails with transient entities 
> -----------------------------------------------------------------------------
>
>                 Key: HHH-5534
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5534
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.5.5
>         Environment: Hibernate 3.5.5, Oracle 10g.
>            Reporter: Kyrill Alyoshin
>            Assignee: Gail Badner
>             Fix For: 3.5.6, 3.6.x
>
>
> Something happened from 3.5.4 to 3.5.5. Here is regression issue we're experiencing after upgrade:
> We have entities ResearchClientFile and ResearchVendorRecord.
> RCF maps RVR:
> @Sort(type = SortType.NATURAL)
>     @OneToMany(mappedBy = "file", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
>     public SortedSet<ResearchVendorRecord> getRecords() {
>         return records;
>     }
> RVR maps RCF:
> @ManyToOne(fetch = FetchType.LAZY, optional = false)
>     @JoinColumn(name = "research_client_file_id")
>     public ResearchClientFile getFile() {
>         return file;
>     }
> The following unit test:
> ResearchClientFile rcf = RandomUtils.randomBean(ResearchClientFile.class);
> rcf.addRecord(RandomUtils.randomBean(ResearchVendorRecord.class));
> rcf = session.merge(rcf);
> produces the following exception in 3.5.5 but not in 3.5.4.:
> java.lang.NullPointerException: null entities are not supported by org.hibernate.event.def.EventCache
> 	at org.hibernate.event.def.EventCache.containsKey(EventCache.java:80)
> 	at org.hibernate.event.def.DefaultMergeEventListener.mergeTransientEntity(DefaultMergeEventListener.java:361)
> 	at org.hibernate.event.def.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:303)
> 	at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:258)
> 	at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:869)
> equals, hashCode and compareTo are completely consistent in RVR. 
> The issue seems to affects only Set and SortedSets and on merge only. Lists (with bag semantics) do not appear to be affected on merge.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list