Spring Data JPA 使用@Query实现数据库的CRUD
1、使用参数索引
public interface UserRepo extends JpaRepository<User,Long>{
@Query("select p from User p where p.address= ?1")
List<User> findByAddress(String address);
}
2、使用命名参数
public interface UserRepo extends JpaRepository