Spring-Data中的唯一查询创建结果

时间:2014-10-20 09:31:08

标签: spring spring-data

我正在使用Spring {Data的查询创建,如here所述。 我有一个ID到Person,还有一个secId,它也是一个唯一的ID。 我希望能够写

  Person findBySecId(long secId);

因为我知道我只会得到一个结果。

现在正如我所见,我只能写

List<Person> findBySecId(long secId);

然后我必须提取第一个元素。

有没有任何已知方法可以做我想要的事情?

0 个答案:

没有答案