first of all i don't know which hibernate-version you're using ...
but take a look in the source of "IdentifierGeneratorFactory" ... (one big advantage of open source ;) )
Here's the code from v2.18
Code:
static Number createNumber(long value, Class clazz) throws IdentifierGenerationException {
if ( clazz==Long.class ) {
return new Long(value);
}
else if ( clazz==Integer.class ) {
return new Integer( (int) value );
}
else if ( clazz==Short.class ) {
return new Short( (short) value );
}
else {
throw new IdentifierGenerationException("this id generator generates long, integer, short");
}
}
Then it's quite clear why you're getting the exception ;)
HiH
curio
Btw: providing all required information is leading to much faster help ;)