2013-06-11 9 views
10

私は以下のようなインタフェースを作成でき、Spring Dataは自動的に必要なデータベースアクセスを生成することを知っています。今私がしたいのは、一連の基準に一致するエンティティの数を数える新しいメソッド名を追加することです。「Count By」メソッド名の書き込み方法Springデータのクエリ

public interface EventRegistrationRepository extends JpaRepository<EventRegistration, String> 
{  
    List<EventRegistration> findByUser_EmailAddress(String email); 

    int countByEvent_Code(String eventCode); 
} 

countByメソッドは、このエラーの原因となる今のところ:

Caused by: org.springframework.data.mapping.PropertyReferenceException: No property count found for type com.brazencareerist.brazenconnect.model.relational.EventRegistration 

私はここで何をしようとしているの正しい構文は何ですか?

答えて

14

これは、just releasedのSpring Data JPA 1.4.0.M1の場合と同様に動作します。

+0

まさに私たちが必要なもの! –

+2

素晴らしい、ありがとうオリバー。春のデータが揺れる! – HappyCoder86

+1

こんにちは!リンクが死んでいる –

関連する問題