Denis A. Magda created IGNITE-13028:
---------------------------------------

             Summary: Spring Data integration doesn't introspect the fields of 
the key object
                 Key: IGNITE-13028
                 URL: https://issues.apache.org/jira/browse/IGNITE-13028
             Project: Ignite
          Issue Type: Improvement
          Components: springdata, spring
    Affects Versions: 2.8
            Reporter: Denis A. Magda
             Fix For: 2.9


Suppose you have key and value POJOs associated with Ignite caches/tables:
* Key: 
https://github.com/GridGain-Demos/ignite-spring-data-demo/blob/master/src/main/java/org/gridgain/demo/springdata/model/CityKey.java
* Value: 
https://github.com/GridGain-Demos/ignite-spring-data-demo/blob/master/src/main/java/org/gridgain/demo/springdata/model/City.java

The key object includes a couple of fields ({code}id{code} and 
{code}countryCode{code}) 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 {code}id{code} 
field|https://github.com/GridGain-Demos/ignite-spring-data-demo/blob/master/src/main/java/org/gridgain/demo/springdata/dao/CityRepository.java#L42]:

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

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:
{code:java}
public Cache.Entry<CityKey, City> findById(int id);
{code}

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



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to