]
Jason Clawson commented on HHH-672:
-----------------------------------
I apologize, I am not sure how to write a unit test for ComponentType. I am not that
familiar with how the object graph gets created. If someone could help me out with this,
I would appreciate it.
bug in ComponentType isModified method ClassCastException (dom4j)
-----------------------------------------------------------------
Key: HHH-672
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-672
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.1 rc3
Environment: Hibernate 3.1 (stream), oracle 9.02
Reporter: Jessica Marchiori
Attachments: ComponentType.java.patch
There is a bug with the EntityMode.DOM4j in class ComponentType method isModified. The
association of oldValues causes a ClassCastException
The original code was
public boolean isModified(Object old, Object current, SessionImplementor session)
throws HibernateException {
if ( current == null ) return old != null;
if ( old == null ) return current != null;
Object[] currentValues = getPropertyValues( current, session );
Object[] oldValues = ( Object[] ) old;
}
for ( int i = 0; i < currentValues.length; i++ ) {
if ( propertyTypes[i].isModified( oldValues[i], currentValues[i], session ) ) {
return true;
}
}
return false;
}
I have changed the code as below
public boolean isModified(Object old, Object current, SessionImplementor session)
throws HibernateException {
if ( current == null ) return old != null;
if ( old == null ) return current != null;
Object[] currentValues = getPropertyValues( current, session );
Object[] oldValues = getPropertyValues( old, session );
for ( int i = 0; i < currentValues.length; i++ ) {
if ( propertyTypes[i].isModified( oldValues[i], currentValues[i], session ) ) {
return true;
}
}
return false;
}
and it works
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: