Incredible.
By treating the cache with withKeepBinary (), obviously the
IgniteBiPredicate <Integer, BinaryObject> also, now WORKS! However, such a
solution is not normal.
Below the classes and the search method:
public class SimplePojo implements Serializable{
private static final long serialVersionUID = 1L;
private Integer id;
private String str1;
public SimplePojo() {}
public Integer getId() {return id;}
public String getStr1() {return str1;}
public void setId(Integer id) {this.id = id;}
public void setStr1(String str1) {this.str1 = str1;}
}
public class SmplePojoFilter implements IgniteBiPredicate<Integer,
BinaryObject> {
private static final long serialVersionUID = 1L;
private Integer idToFind;
private String srtToFind;
public SmplePojoFilter() {}
public SmplePojoFilter(Integer idToFind, String srtToFind) {
super();
this.idToFind = idToFind;
this.srtToFind = srtToFind;
}
@Override
public boolean apply(Integer e1, BinaryObject e2) {
SimplePojo sp =
e2.deserialize(SimplePojo.class.getClassLoader());
return sp.getId().equals(idToFind);
}
}
IgniteCache<Integer, SimplePojo> cache = ignite.getOrCreateCache(c_cfg);
SmplePojoFilter spf = new SmplePojoFilter(1, null);
Collection<SimplePojo> res = new ArrayList<>();
try(QueryCursor<Cache.Entry<Integer, SimplePojo>> cursor =
cache.withKeepBinary().query(new ScanQuery<>(spf))){
cursor.forEach(entry->res.add(entry.getValue().deserialize()));
}
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/