In SessionFactoryImpl, the catch clause which throws a MappingException with
the message "Could not instantiate persister class:..." (line 180 in
v1.1.4b) discards the more detailed exception it receives (e).
In my case, I did something dumb - adding a new key column to a table
without adding the corresponding getter/setter - and then had to figure out
what "Could not instantiate persister class..." was trying to tell me. Via
debugging, I found that the exception that was discarded read "Could not
find a setter for..." which would have been a lot more helpful, especially
while suffering from a case of lamebrain...
Not sure what the Hibernate-appropriate fix should be - the ideal solution
in this kind of case, IMO, would be to throw a chained exception (like the
JDK 1.4 feature), so that exception context is not lost. Is Hibernate using
anything like that? I haven't noticed. If not, just tacking the exception
strings together would work in this case.
Anton
|