So I know that I can write an interface like the one below and Spring Data will automatically generate the necessary database access stuff for me. Now what I'd like to do is add a new method name that will count the number of entities that match a set of criteria.
public interface EventRegistrationRepository extends JpaRepository<EventRegistration, String>
{
List<EventRegistration> findByUser_EmailAddress(String email);
int countByEvent_Code(String eventCode);
}
As of now the countBy method causes this error:
Caused by: org.springframework.data.mapping.PropertyReferenceException: No property count found for type com.brazencareerist.brazenconnect.model.relational.EventRegistration
What's the proper syntax for what I'm trying to do here?
This works as expected as of the just released Spring Data JPA 1.4.0.M1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With