Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-13028

Spring Data integration doesn't introspect the fields of the key object

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.8
    • Fix Version/s: 2.10
    • Component/s: spring, springdata
    • Labels:
    • Release Note:
      Spring Data integration introspects the fields of the key object (in case of using compound key)
    • Ignite Flags:
      Docs Required, Release Notes Required

      Description

      Suppose you have key and value POJOs associated with Ignite caches/tables:

      The key object includes a couple of fields (id and countryCode) that are not visible to the Spring's query-autogeneration feature. For instance, you have to use direct queries if want to get all the cities with a specific value of id field:

      @Query("SELECT * FROM City WHERE id = ?")
      public Cache.Entry<CityKey, City> findById(int id);
      

      If the query-autogeneration feature could introspect the metadata of the key, then you would not need to fall back to the direct queries and would add the following query to the repository:

      public Cache.Entry<CityKey, City> findById(int id);
      

      The same issue exists if a key is of a primitive type (Integer, String, etc.)

      To reproduce you can use this project:
      https://github.com/GridGain-Demos/ignite-spring-data-demo

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                kazakov Ilya Kazakov
                Reporter:
                dmagda Denis A. Magda
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m