所以我知道我可以编写如下所示的接口,Spring Data会自动为我生成必要的数据库访问内容.现在我要做的是添加一个新的方法名称,它将计算符合一组条件的实体数量.
public interface EventRegistrationRepository extends JpaRepository<EventRegistration, String>
{
List<EventRegistration> findByUser_EmailAddress(String email);
int countByEvent_Code(String eventCode);
}
Run Code Online (Sandbox Code Playgroud)
截至目前,countBy方法导致此错误:
Caused by: org.springframework.data.mapping.PropertyReferenceException: No property count found for type com.brazencareerist.brazenconnect.model.relational.EventRegistration
Run Code Online (Sandbox Code Playgroud)
我正在尝试做什么的正确语法是什么?
| 归档时间: |
|
| 查看次数: |
16141 次 |
| 最近记录: |