Results 1 to 3 of 3

Thread: Does Spring Data JPA have any way to count entities using specifications?

  1. #1
    Join Date
    Nov 2008
    Posts
    5

    Default Does Spring Data JPA have any way to count entities using specifications?

    In Hades you could say myDao.count(mySpecification) but there is no such method in Spring Data JPA Repositories, only myDao.count(). Is there any other way to achieve this?

  2. #2
    Join Date
    Nov 2008
    Posts
    5

    Default

    Okay as soon as I asked, I found the solution... Your Repository has to extend the JpaSpecificationExecutor interface. As you can guess, I'm in the middle of migrating from Hades to Data JPA

  3. #3
    Join Date
    May 2012
    Posts
    2

    Question Dose Spring Data JPA have any way to count entites using method name resolving?

    Quote Originally Posted by palto View Post
    Okay as soon as I asked, I found the solution... Your Repository has to extend the JpaSpecificationExecutor interface. As you can guess, I'm in the middle of migrating from Hades to Data JPA
    So how about using method name resolving?
    I want a method coutByName to count entites with specific name, just like a method findByName to fetch all entites with specific name.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •