Re: SqlQueryFileds on List of Binary Object
Hi, As for now, it's not possible to query objects if they're stored as collection like IgniteCache >, so, I'd recommend changing the way how you store objects in cache - it will be pretty the same if you will store it like IgniteCache Evgenii -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: SqlQueryFileds on List of Binary Object
Hi , The Reason is i am trying to do it though load method , which supports the read through. The requirement is to pass a set of param say Map which will contain a sql statement some query param value and the return will be the list of BinaryObject . That is against one key I want to hold all the binaryobejct and then query it from within the list using SqlQueryFields -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/
Re: SqlQueryFileds on List of Binary Object
Hello! Why do you try to store List in cache? It should work if you will just put plain BinaryObject's in it without List<>. Regards, -- Ilya Kasnacheev 2018-07-18 17:42 GMT+03:00 debashissinha : > Hi , > > If I add a List to cache and also in the cache configuration > I > set QueryEntity with fields, then how can I query using > cache.query(new SqlFieldQuery("Some sql")); > > Sample I am trying to use is > > CacheConfiguration> cfg = new > CacheConfiguration(); > cfg.setQueryEntities(new ArrayList(){{ > > e.setKeyType("java.lang.Integer"); > e.setValueType("Person"); > e.setFields(new LinkedHashMap(){{ > > put("id","java.lang.Integer"); > put("name","java.lang.String"); > > }}); > add(e); > }}); > > cfg.setName("TESTPERSON"); > > Ignite ignite = Ignition.start(); > IgniteCache> cache = > ignite.getOrCreateCache(cfg).withKeepBinary(); > > List binaryObjectList = new ArrayList(); > IgniteBinary binary = binary.builder("Person"); > > bldr.setField("id",1); > bldr.setField("name","test"); > binaryObjectList.add(bldr.build()); > > cache.put(1,binaryObjectList); > > QueryCursor> cursor = cache.query(new SqlFieldsQuery("Select * > from Person")); > > Am getting empty results here. > Can some one kindly help . > > Thanks in advance. > Debashis Sinha > > > > -- > Sent from: http://apache-ignite-users.70518.x6.nabble.com/ >
SqlQueryFileds on List of Binary Object
Hi , If I add a List to cache and also in the cache configuration I set QueryEntity with fields, then how can I query using cache.query(new SqlFieldQuery("Some sql")); Sample I am trying to use is CacheConfiguration> cfg = new CacheConfiguration(); cfg.setQueryEntities(new ArrayList(){{ e.setKeyType("java.lang.Integer"); e.setValueType("Person"); e.setFields(new LinkedHashMap(){{ put("id","java.lang.Integer"); put("name","java.lang.String"); }}); add(e); }}); cfg.setName("TESTPERSON"); Ignite ignite = Ignition.start(); IgniteCache> cache = ignite.getOrCreateCache(cfg).withKeepBinary(); List binaryObjectList = new ArrayList(); IgniteBinary binary = binary.builder("Person"); bldr.setField("id",1); bldr.setField("name","test"); binaryObjectList.add(bldr.build()); cache.put(1,binaryObjectList); QueryCursor> cursor = cache.query(new SqlFieldsQuery("Select * from Person")); Am getting empty results here. Can some one kindly help . Thanks in advance. Debashis Sinha -- Sent from: http://apache-ignite-users.70518.x6.nabble.com/