On 5 November 2013 00:20, Scott Marlow <smar...@redhat.com> wrote: > HHH-8670 is about EntityManager.find() not returning null when a runtime > exception is caught when performing the find(). Returning null when a > ClassCastException (or any other runtime exception) occurs seems > confusing to me, but I suppose that we could log a DEBUG warning (like > we did for EntityNotFoundException). > > Does anyone disagree with changing Hibernate ORM to return null when a > runtime exception is caught during the EntityManager.find() operation?
I would disagree yes, seems wrong. A failure is a failure, a null would imply the entity doesn't exist which is misleading. Shouldn't it simply throw the runtime exception? And ideally fix the ClassCastException to not ever happen? I might have misunderstood how that is happening: the way you describe it I got the impression that there's a bug in ORM, but even if this was a user mistake, by changing this semantic you wouldn't give the opportunity to the user to fix his code. Sanne > > Scott > _______________________________________________ > hibernate-dev mailing list > hibernate-dev@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/hibernate-dev _______________________________________________ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev