Add a method that would return the entity wrapped in Optional class, instead of returning null.
Optional<Event> optional = session.getOptional(Event.class, id);
// or through Query interfaceOptional<Event> optional = session.createQuery("from Event where id = :id").setParameter("id", id).optionalResult();
We may also decide to completly redesign the existing API and to make this the default behaviour of the Session#get method.