Results 1 to 6 of 6

Thread: Query Caching

  1. #1
    Join Date
    Nov 2010
    Posts
    16

    Default Query Caching

    Is query caching possible with Spring Data JPA



    @Query("select p from Person p order by personNumber ASC")
    List<Branch> findAllPersonsOrderByPersonNumberAsc();


    - can I apply some form of query cache - hibernate/echache to this ?

    Thanks
    Mappy

  2. #2
    Join Date
    Nov 2010
    Posts
    16

    Default More detail for Query Caching

    So I'd like to cache the results from findAll and findOne, but it seems to ignore the cache

    @Query("from People")
    @QueryHints({ @QueryHint(name = "org.hibernate.cacheable", value ="true") })
    List<People> findAll();


    However If I change the method name it works, Id rather not have 2 methods findAll and findAllCached


    @Query("from People")
    @QueryHints({ @QueryHint(name = "org.hibernate.cacheable", value ="true") })
    List<People> findAllCached();

  3. #3
    Join Date
    Apr 2006
    Location
    Dresden, Germany
    Posts
    483

    Default

    Currently the CRUD methods cannot be equipped with @QueryHints. Feel free to open a JIRA if you like to see that supported.

  4. #4
    Join Date
    Nov 2010
    Posts
    16

    Default Query Caching

    Thanks Oliver, I will raise a JIRA
    What's the easiest way to get involved in Developing Spring Data?


    Thanks
    Mappy

  5. #5
    Join Date
    Mar 2010
    Posts
    10

    Default

    Oliver:
    Are @QueryHint on CRUD methods supported in JPA 1.0.2?
    thanks
    *K

  6. #6
    Join Date
    Apr 2006
    Location
    Dresden, Germany
    Posts
    483

    Default

    Nope, no ticket implies no relevance implies no fix . But feel free to create one if it matters to you.

Posting Permissions

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