This happens because the session factory can be null. For example, when using LoadQueryInfluencers.NONE