Skip to content Skip to sidebar Skip to footer

Usage Of JPA In SpringBoot

I made this query but I'm not sure if there's a way not to use native query. I need to find the count of the team plan subscription (of an smsplan) that is using this certain outgo

Solution 1:

Replicating your model as follows (correct me if I got something wrong when reading your question):

Subscription > Plan > RateCard

The number of subscriptions having plans with the same rate-card-id can be counted with this method in the SubscriptionRepository:

public long countByPlanRateCardId(long rateCardId);

Most probably there was some typo in your repository (might be some unnecessary _id_ in there).

demo project on github

official documentation: https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#repositories


Post a Comment for "Usage Of JPA In SpringBoot"