hibernate: 3.2.5.ga
hibernate-annotations: 3.3.0.ga
I'm having exactly the same issue.
Browsing a bit the source code, i realized that the NullPointerException is being raised beacause the following method returns null in org.hibernate.annotations.common.reflection.java.JavaXCollectionType:
Code:
public XClass getMapKey() {
return new TypeSwitch<XClass>() {
@Override
public XClass caseParameterizedType(ParameterizedType parameterizedType) {
if ( getCollectionClass().isAssignableFrom( Map.class ) ) {
return toXClass( parameterizedType.getActualTypeArguments()[0] );
}
return null;
}
}.doSwitch( approximate() );
}
More specifically, the following expression seems misconstructed to me:
Code:
getCollectionClass().isAssignableFrom( Map.class )
The correct expression would be, imho:
Code:
Map.class.isAssignableFrom( getCollectionClass() )
I couldn't find any similar bug in Hibernate JIRA. Should I fire a bug for this?