Announcement Announcement Module
Collapse
No announcement yet.
Does Spring Data JPA have any way to count entities using specifications? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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

    Comment


    • #3
      Dose Spring Data JPA have any way to count entites using method name resolving?

      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.

      Comment

      Working...
      X