ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "kcheng.mvp" <kcheng....@gmail.com>
Subject Caused by: class org.apache.ignite.internal.processors.query.IgniteSQLException: Failed to find SQL table for type: UserAppInfo
Date Sat, 02 Dec 2017 08:17:35 GMT
I run into this issue, cache.put/cache.get works well. 

here is my configuration.

<beans xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="         http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd        
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <description>
    Main Spring file for ignite configuration.
  </description>
  <bean id="ignite.config.server"
class="org.apache.ignite.configuration.IgniteConfiguration"
scope="singleton">
    <property name="igniteInstanceName" value="ignitedc"/>
    <property name="peerClassLoadingEnabled" value="true"/>
    <property name="discoverySpi">
      <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
        <property name="ipFinder">
          <bean
class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
            <property name="addresses">
              <bean class="org.springframework.util.StringUtils"
factory-method="commaDelimitedListToStringArray">
                <constructor-arg type="java.lang.String"
value="172.18.118.143:47500..47509,172.18.118.141:47500..47509,172.18.118.142:47500..47509"/>
              </bean>
            </property>
          </bean>
        </property>
      </bean>
    </property>
    <property name="dataStorageConfiguration">
      <bean
class="org.apache.ignite.configuration.DataStorageConfiguration">
        <property name="pageSize" value="4096"/>
        <property name="defaultDataRegionConfiguration">
          <bean
class="org.apache.ignite.configuration.DataRegionConfiguration">
            <property name="persistenceEnabled" value="true"/>
          </bean>
        </property>
        <property name="dataRegionConfigurations">
          <list>
            <bean
class="org.apache.ignite.configuration.DataRegionConfiguration">
              <property name="name" value="UserSocial"/>
              <property name="initialSize" value="#{500L * 1024L * 1024L}"/>
              <property name="maxSize" value="#{1024L * 1024L * 1024L *
5L}"/>
              <property name="persistenceEnabled" value="true"/>
            </bean>
            <bean
class="org.apache.ignite.configuration.DataRegionConfiguration">
              <property name="name" value="UserInfo"/>
              <property name="initialSize" value="#{500L * 1024L * 1024L}"/>
              <property name="maxSize" value="#{1204L * 1024L * 1024L *
4L}"/>
              <property name="persistenceEnabled" value="true"/>
            </bean>
            <bean
class="org.apache.ignite.configuration.DataRegionConfiguration">
              <property name="name" value="UserAppInfo"/>
              <property name="initialSize" value="#{500L * 1024L * 1024}"/>
              <property name="maxSize" value="#{1204L * 1024L * 1024L *
3L}"/>
              <property name="persistenceEnabled" value="true"/>
            </bean>
            <bean
class="org.apache.ignite.configuration.DataRegionConfiguration">
              <property name="name" value="AppInfo"/>
              <property name="initialSize" value="#{500L * 1024L * 1024}"/>
              <property name="maxSize" value="#{1204L * 1024L * 1024L *
2L}"/>
              <property name="persistenceEnabled" value="true"/>
            </bean>
          </list>
        </property>
      </bean>
    </property>
    <property name="cacheConfiguration">
      <util:list xmlns:util="http://www.springframework.org/schema/util"
id="caches" value-type="org.apache.ignite.configuration.CacheConfiguration"
list-class="java.util.ArrayList">
        <bean parent="cache">
          <property name="name" value="UserSocial"/>
          <property name="dataRegionName" value="UserSocial"/>
        </bean>
        <bean parent="cache">
          <property name="name" value="UserInfo"/>
          <property name="dataRegionName" value="UserInfo"/>
        </bean>
        <bean parent="cache">
          <property name="name" value="UserAppInfo"/>
          <property name="dataRegionName" value="UserAppInfo"/>
        </bean>
        <bean parent="cache">
          <property name="name" value="AppInfo"/>
          <property name="dataRegionName" value="AppInfo"/>
        </bean>
      </util:list>
    </property>
  </bean>
  <bean id="cache"
class="org.apache.ignite.configuration.CacheConfiguration" abstract="true">
    <property name="cacheMode" value="PARTITIONED"/>
    <property name="backups" value="1"/>
  </bean>
</beans>

UserAppInfo.java

public class UserAppInfo implements Serializable{
    private static final long serialVersionUID = -6137971973241293268L;

    @QuerySqlField(index = true)
    private String appId;

    @QuerySqlField(index = true)
    private String uid;


    @QuerySqlField
    private String platform;


    @QuerySqlField
    private Date registerTime;

    @QuerySqlField
    private Date lastAuthTime;

    @QuerySqlField
    private Integer authCount;


    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public String getPlatform() {
        return platform;
    }

    public void setPlatform(String platform) {
        this.platform = platform;
    }

    public Date getRegisterTime() {
        return registerTime;
    }

    public void setRegisterTime(Date registerTime) {
        this.registerTime = registerTime;
    }

    public Date getLastAuthTime() {
        return lastAuthTime;
    }

    public void setLastAuthTime(Date lastAuthTime) {
        this.lastAuthTime = lastAuthTime;
    }

    public Integer getAuthCount() {
        return authCount;
    }

    public void setAuthCount(Integer authCount) {
        this.authCount = authCount;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        UserAppInfo that = (UserAppInfo) o;

        if (appId != null ? !appId.equals(that.appId) : that.appId != null)
return false;
        return uid != null ? uid.equals(that.uid) : that.uid == null;
    }

    @Override
    public int hashCode() {
        int result = appId != null ? appId.hashCode() : 0;
        result = 31 * result + (uid != null ? uid.hashCode() : 0);
        return result;
    }

    public AffinityKey affinityKey(){
        return new AffinityKey(appId, uid);
    }
}

3: test code

 @Test
    public void happyFlow(){
        UserAppInfo userAppInfo = dynamicUserAppInfo();
        userAppInfoService.put(userAppInfo);
        UserAppInfo userAppInfo1 =
userAppInfoService.get(userAppInfo.getAppId(), userAppInfo.getUid());
        Assert.assertNotNull(userAppInfo1);
        Assert.assertEquals(userAppInfo1, userAppInfo); //works well
        SqlQuery sql = new SqlQuery(UserAppInfo.class, "appid =
?").setArgs(userAppInfo.getAppId());
       
userAppInfoService.getCache(PersistenceService.CacheName.USER_APP_INFO).query(sql);
// runs into the issue
    }



--
Sent from: http://apache-ignite-developers.2346864.n4.nabble.com/

Mime
View raw message