[hibernate-issues] [Hibernate-JIRA] Created: (HHH-2757) Cascade.cascadeCollectionElements ClastCastException for non-entity element types

Alan Krueger (JIRA) noreply at atlassian.com
Mon Jul 30 15:48:11 EDT 2007


Cascade.cascadeCollectionElements ClastCastException for non-entity element types
---------------------------------------------------------------------------------

                 Key: HHH-2757
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2757
             Project: Hibernate3
          Issue Type: Bug
    Affects Versions: 3.2.2
         Environment: Hibernate 3.2.2.ga with PostgreSQL 8.2
            Reporter: Alan Krueger


When trying to flush changes in EntityMode.DOM4J, a composite element causes a ClassCastException in Cascade.cascadeCollectionElements when invoked by Cascade.cascadeCollection.  The latter allows the call to the former when the element is of ComponentType, but assumes in the former always casts to EntityType if EntityMode.DOM4J is in effect.


Possible patch:

diff -u -r1.1 Cascade.java
--- src/org/hibernate/engine/Cascade.java	3 Jul 2007 20:12:01 -0000	1.1
+++ src/org/hibernate/engine/Cascade.java	30 Jul 2007 19:42:54 -0000
@@ -281,7 +281,7 @@
 			final boolean isCascadeDeleteEnabled) throws HibernateException {
 		// we can't cascade to non-embedded elements
 		boolean embeddedElements = eventSource.getEntityMode()!=EntityMode.DOM4J ||
-				( (EntityType) collectionType.getElementType( eventSource.getFactory() ) ).isEmbeddedInXML();
+				( elemType.isEntityType() && ( (EntityType) elemType ).isEmbeddedInXML() );
 
 		boolean reallyDoCascade = style.reallyDoCascade(action) &&
 			embeddedElements && child!=CollectionType.UNFETCHED_COLLECTION;


-- 
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