pasniak commented on issue #11042:
URL: https://github.com/apache/ignite/issues/11042#issuecomment-1811542633

   I figured it out.  Value's SQL field name is specified in `valueFieldName` 
property:
   ```
   <property name="valueFieldName" value="lastValue"/>
   ```
   The SQL field has also to be present in `fields` map:
   ```
   <entry key="lastValue" value="java.lang.String"/>
   ``` 
   After put() ...
   ```
               ClientCache<MyCustomKey, String> cache = 
client.getOrCreateCache("PERSONCACHE");
               MyCustomKey myCustomKey = new MyCustomKey("Adam", "Edsel");
               cache.put(myCustomKey, "test value 2");
   ```
   ... the column is visible in a query result:
   ```
   0: jdbc:ignite:thin://127.0.0.1/> select * from personCache.STRING;
   +-----------+----------+--------------+
   | FIRSTNAME | LASTNAME |  LASTVALUE   |
   +-----------+----------+--------------+
   | Adam      | Edsel    | test value 2 |
   +-----------+----------+--------------+
   ```
   
   Full XML:
   ```
       <bean class="org.apache.ignite.configuration.IgniteConfiguration">
           <property name="cacheConfiguration">
               <bean class="org.apache.ignite.configuration.CacheConfiguration">
                   <property name="name" value="PERSONCACHE"/>
                   <property name="queryEntities">
                       <list>
                           <bean class="org.apache.ignite.cache.QueryEntity">
                               <property name="keyType" 
value="org.examples.MyKey"/>
                               <property name="valueType" 
value="java.lang.String"/>
                               <property name="valueFieldName" 
value="lastValue"/>
                               <property name="fields">
                                   <map>
                                       <entry key="firstName" 
value="java.lang.String"/>
                                       <entry key="lastName" 
value="java.lang.String"/>
                                       <entry key="lastValue" 
value="java.lang.String"/>
                                   </map>
                               </property>
                               <property name="keyFields">
                                   <set>
                                       <value>firstName</value>
                                       <value>lastName</value>
                                   </set>
                               </property>
                           </bean>
                       </list>
                   </property>
               </bean>
           </property>
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to