标签: spring spring-data
我正在使用Spring {Data的查询创建,如here所述。 我有一个ID到Person,还有一个secId,它也是一个唯一的ID。 我希望能够写
Person findBySecId(long secId);
因为我知道我只会得到一个结果。
现在正如我所见,我只能写
List<Person> findBySecId(long secId);
然后我必须提取第一个元素。
有没有任何已知方法可以做我想要的事情?