Vinay, The last put operation updates Person with key '2' and changes its 'id' field value to '3'. As a result, there are no persons with id=2 and SQL query, which selects by this condition, returns empty result. Test query is based on 'personName' field which is not changed, therefore result of the query does not change as well.
As for error in 1.5.0, you definitely still have 1.4 node(s) running somewhere. Please double-check Java processes of your computer and other computers in the same network if there are any. -Val On Mon, Jan 11, 2016 at 10:29 PM, vinshar <[email protected]> wrote: > Hi, > > Below is a test code for a behavior i noticed. Below code returns nothing > for SQL query if i add a entry twice on cache. I tested this with 1.4 > version. > > problem 1:- For below code, SQL query returns no result where as text query > does. If i comment 3rd put comment then both SQL and text queries return > result. Text query returns 1 value both times. > > Problem 2:- If i enable client mode i see ClassNotFound exception for > Person > class in server node logs. This appears even if peerClassLoading is true on > both client and server. > > problem 3:- If i upgrade POM to use version 1.5.0.final then i get > following > error even though client node is false and there is no other node running > on > my local machine. > > /Caused by: class org.apache.ignite.spi.IgniteSpiException: Local node and > remote node have different version numbers (node will not join, Ignite does > not support rolling updates, so versions must be exactly the same)/ > > public static void main(String[] args) throws Exception { > class Person implements Serializable { > /** > * > */ > private static final long serialVersionUID = 1L; > > @QuerySqlField(index = true) > private int id; > > @QueryTextField > private String personName; > > public Person(int personId, String personName) { > super(); > this.id = personId; > this.personName = personName; > } > > public int getId() { > return id; > } > > public void setId(int personId) { > this.id = personId; > } > > public String getPersonName() { > return personName; > } > > public void setPersonName(String personName) { > this.personName = personName; > } > > } > > Ignite ignite = Ignition.start(new > > IgniteConfiguration().setClientMode(false).setPeerClassLoadingEnabled(true)); > > CacheConfiguration<Integer, Person> config = new > CacheConfiguration<>(); > config.setName("PROBLEM"); > config.setIndexedTypes(Integer.class, Person.class); > IgniteCache cache = ignite.createCache(config); > > cache.put(1, new Person(1,"test1")); > cache.put(2, new Person(2,"test2")); > cache.put(2, new Person(3,"test2")); > > SqlQuery<Integer, Person> sql = new > SqlQuery<>(Person.class, "from Person > where id = 2"); > TextQuery<Integer, Person> text = new > TextQuery<>(Person.class, "test2"); > > > System.out.println("##################################################################"); > System.out.println(cache.get(2)); > System.out.println(cache.query(sql).getAll()); > System.out.println(cache.query(text).getAll()); > > > System.out.println("##################################################################3"); > > } > > > > > > > > -- > View this message in context: > http://apache-ignite-users.70518.x6.nabble.com/SQL-Query-returns-no-value-if-different-values-put-twice-with-same-key-tp2509.html > Sent from the Apache Ignite Users mailing list archive at Nabble.com. >
