Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: Spring Data JPA, custom methods and inheritance

  1. #11
    Join Date
    Apr 2011
    Posts
    107

    Default

    You'll have to declare the finder in each class to get the automatic generation, else you need to write your own query implementation.

  2. #12
    Join Date
    May 2011
    Posts
    16

    Default

    I basically just need a method in the base class so that I can create a BaseRepository<T> to work with my BaseService<T>. I will make my own implementation, however, it's curious that even when I declared T findByCode(String) in my BaseRepository and then extended that and included MyClass findByCode(String), I got the same message exception.

    Perhaps that could be an enhancement for future releases.

    -AP_

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

    Default

    Simple answer is: currently we don't support that interface structuring model. We only check the methods declared in the concrete repository interface and assume any method not declared in it and not implemented by the class backing the proxy (SimpleJpaRepository in the JPA case) being a custom method.

    The reason we do that is to be able to fail a bit faster as the actual potential custom implementation class is handed in at a later stage (which we would need to discover custom methods more strictly). This is nothing set in stone so I encourage you to simply open an issue in our JIRA as this seems to be a very reasonable feature request.

    Thanks for reporting the issue in that detail already!

    Ollie

Tags for this Thread

Posting Permissions

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