-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Incorrect warnings for composite-id problems
PostPosted: Fri May 20, 2005 6:45 am 
Newbie

Joined: Fri May 20, 2005 6:28 am
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.