Complete the code to declare a JPA repository interface.
public interface UserRepository extends [1]<User, Long> {}The JpaRepository interface provides JPA related methods for database access.
Complete the code to annotate an entity class for JPA.
@[1] public class Product { @Id private Long id; }
The @Entity annotation marks the class as a JPA entity mapped to a database table.
Fix the error in the repository method to find by name.
List<User> findBy[1](String name);In Spring Data JPA, query method names use 'findBy' followed by the capitalized property name, so findByName is correct if the field is 'name'.
Complete the code to create a JPA query method that finds products cheaper than a price.
List<Product> findByPrice[1](Double price);findByPriceLessThan finds products with price less than the given value. No extra parameter is needed here.
Fill all three blanks to write a JPA query method that finds users by email containing a keyword and orders by id descending.
List<User> findByEmail[1][2]OrderById[3](String keyword);
The method findByEmailContainingIgnoreCaseOrderByIdDesc finds users whose email contains the keyword, orders results by id descending, ignoring case.