[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-672) bug in ComponentType isModified method ClassCastException (dom4j)
David Morton (JIRA)
noreply at atlassian.com
Fri Nov 3 10:07:05 EST 2006
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-672?page=comments#action_25121 ]
David Morton commented on HHH-672:
----------------------------------
This error occurs for me when the parent entity (class) has SelectBeforeUpdate="true". The error occurs in the many-to-one association based on a composite key. If SelectBeforeUpdate="false" I don't get the same behaviour.
> bug in ComponentType isModified method ClassCastException (dom4j)
> -----------------------------------------------------------------
>
> Key: HHH-672
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-672
> Project: Hibernate3
> Type: Bug
> Components: core
> Versions: 3.1 rc3
> Environment: Hibernate 3.1 (stream), oracle 9.02
> Reporter: Jessica Marchiori
>
>
> 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:
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