Once again, this will crash when `getId()` returns `null`. Have a look at `ObjectUtils.equals()`.