9
具有参数属性的Spring数据JPA查询
声明使用输入参数的属性作为查询参数的Spring数据JPA查询的最简单方法是什么? 例如,假设我有一个实体类: public class Person { @Id private long id; @Column private String forename; @Column private String surname; } 和另一类: public class Name { private String forename; private String surname; [constructor and getters] } ...那么我想编写一个Spring数据存储库,如下所示: public interface PersonRepository extends CrudRepository<Person, Long> { @Query("select p from Person p where p.forename = …