avoid invoking batch commit at exit when there's no uncommitted entity