setEntity(xyz, null) ends in a NPE in SessionImpl.guessEntityName(). This previously came up as
HHH-675. I just spent hours tracking this NPE in our application, then upgrading Hibernate because I thought it might be a Hibernate bug :-/. The offending line read:
.setEntity("customer", user.getCustomer())
"user" being an entity managed by Hibernate with user.customer being a nullable ManyToOne-relation. The current mode of "crash-and-burn" really looks like a Hibernate bug and not like expected behavior. I'd like to recommend that setEntity() should explicitly check for null-values.
I really dont understand the whole NPE is evil trip y'all are on here. I mean think about the gist of the problem... You passed a NULL POINTER... How about IllegalArgumentException, does that somehow make it easier?