ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vinshar <vinsharma.t...@gmail.com>
Subject SQL Query returns no value if different values put twice with same key
Date Tue, 12 Jan 2016 06:29:55 GMT
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.

Mime
View raw message