0

I am not able to understand the below method in Spring -JPA.

@RepositoryRestResource
public interface TestRepository extends JpaRepository<Vehicle, BigInteger>{
    public List<Vehicle> findAll(Sort sort);

}

Vehice is a entity or domainobject.

What does the method findAll(Sort sort) do.

Please help me.

2 Answers 2

1

This declare the method already in JpaRepository again.

List<T> JpaRepository.findAll(Sort sort);

with T = Vehicle take all vehicles form the database (or NOSQL store) with a the given sorting and returns them.

@RepositoryRestResource is a annotation to publish this as an HATEAOS rest resource.

Sign up to request clarification or add additional context in comments.

Comments

0

It allows you to find all vehicles, sorted as specified by the Sort parameter.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.