I really find something difference example of these method of Jpa Library.
But I can’t find about this.
So, I record what I meet today.
I am newbie of this JpaRepository and jpa data.
In version 2.0.0. of spring-boot-starter-data-jpa,
after extends JpaRepository from Service Class,
I saw findOne method get error.
So I find other methods.
getOne and findById.
getOne looks good and very similiar with things before I use JpaRepository.
I replace this with findOne.
But domain object doesn’t hold all variables(columns) properly especially subdomain’s object(@DiscriminatorColumn).
So… just use findById. and this will return optional object.
To get out the object, use get() method.
repository.getById(itemId).get();
The findOne from JpaRepository interface is the method for QueryByExampleExecutor. So you need to pass the Example object to the method.