I'd really prefer to get an Exception from Hibernate instead of a silent null value.
That's not going to happen - you are using the JPA method to bootstrap a EMF and as such you are going to have to live with the JPA rules on what that means, which means returning null for the reasons I outlined earlier. If you are using a method defined as possibly returning null, you really need to handle the possibility of null return value. The other option is to make the Hibernate calls yourself. |