How to return just the primary key of a JPA entity

Viewed 13

How to return just the primary key of the following JPA entity instead of the entire object in findByName method

public interface FooRepository extends JpaRepository<Foo, Long> {

    Optional<Foo> findByName(String name);

}
0 Answers
Related