Hi,
I've just noticed that if I have a class with a composite-id and I fail to override equals() or hashcode() I get the warning:
Code:
Could not perform validation checks for component as the class com.wibble.wobble.MyClass was not found
The class is actually present and the application runs fine...
I suspect the problem is in the org.hibernate.cfg.HbmBinder class, lines 404 onwards:
Code:
if ( !id.isDynamic() ) {
try {
Class idClass = id.getComponentClass();
if ( idClass != null && !ReflectHelper.overridesEquals( idClass ) ) {
throw new MappingException( "composite-id class must override equals(): "
+ id.getComponentClass().getName() );
}
if ( !ReflectHelper.overridesHashCode( idClass ) ) {
throw new MappingException( "composite-id class must override hashCode(): "
+ id.getComponentClass().getName() );
}
if ( !Serializable.class.isAssignableFrom( idClass ) ) {
throw new MappingException( "composite-id class must implement Serializable: "
+ id.getComponentClass().getName() );
}
}
catch (MappingException cnfe) {
log.warn( "Could not perform validation checks for component as the class "
+ id.getComponentClassName()
+ " was not found" );
}
}
Which appears to always catch the 'must override/implement' exceptions, discard them, and throw a new 'class was not found' exception.
Hibernate version: 3.0.3