Search code examples
ignitegridgain

Getting null query output after using QueryEntity


I have written following query entity for my database. I provide this file to ignite server node for index mapping. Loading part of data is done through ignite client node.

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd">
    <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
        
	<property name="peerClassLoadingEnabled" value="false"/>
	<property name="cacheConfiguration">
            <list>
          
                <!-- Partitioned cache example configuration (Atomic mode). -->
            <bean class="org.apache.ignite.configuration.CacheConfiguration">
        	<property name="name" value="warehouse_cache"/>   
		    <property name="backups" value="0"/>
		    <property name="copyOnRead" value="true"/>
		    <property name="memoryMode" value="ONHEAP_TIERED"/>
		    <property name="cacheMode" value="PARTITIONED"/>	
			
			 <!-- Configure query entities -->
			<property name="queryEntities">
				<list>
					<bean class="org.apache.ignite.cache.QueryEntity">
						<property name="keyType" value="java.lang.Long"/>
						<property name="valueType" value="schema.warehouse"/>

						<property name="fields">
							<map>
								<entry key="w_id" value="java.lang.Integer"/>
								<entry key="w_name" value="java.lang.String"/>
								<entry key="w_street_1" value="java.lang.String"/>
								<entry key="w_street_2" value="java.lang.String"/>
								<entry key="w_city" value="java.lang.String"/>
								<entry key="w_state" value="java.lang.String"/>
								<entry key="w_zip" value="java.lang.String"/>
								<entry key="w_tax" value="java.lang.Double"/>
								<entry key="w_ytd" value="java.lang.Double"/>
								
							</map>
						</property>

						<property name="indexes">
							<list>
								<bean class="org.apache.ignite.cache.QueryIndex">
									<constructor-arg value="w_id"/>
								</bean>
							</list>
						</property>
					</bean>
				</list>
			</property>		
	        </bean>
            
           
            </list>
    </property>
	
    </bean>
</beans>

All entries of this warehouse table gets loaded correctly(verified using ignitevisorcmd.sh). For this query entity I have created jar file of package schema, which contains warehouse class. I kept this jar file in libs folder in apache ignite installation path. When I run query against this warehouse table, I am getting null output. Why is this happening?


Solution

  • The value type in configuration looks suspicious:

    <property name="valueType" value="schema.warehouse"/>
    

    Make sure that this value is correct value class name. Also what query are you executing?