Spring Data 2.0 and find find[By]One

After upgraded maven dependencies in the old project into current versions – it turned out, that the method from JpaRepository:

entityDAO.findOne(id)

has been replaced in new version by

entityDAO.findById(id)

Everything would be fine, but findById is not exactly the same like a findOne. Such an implementation is a substitute for an earlier method:

entityDAO.findById(id).orElse(null);

 

Leave a Reply

Your email address will not be published. Required fields are marked *