use of org.apache.ignite.binary.BinaryObjectBuilder in project ignite by apache.
the class CacheQueryBuildValueTest method testBuilderAndQuery.
/**
* @throws Exception If failed.
*/
public void testBuilderAndQuery() throws Exception {
Ignite node = ignite(0);
final IgniteCache<Object, Object> cache = node.cache(DEFAULT_CACHE_NAME);
IgniteBinary binary = node.binary();
BinaryObjectBuilder builder = binary.builder(TestBuilderValue.class.getName());
cache.put(0, builder.build());
builder.setField("iVal", 1);
cache.put(1, builder.build());
List<Cache.Entry<Object, Object>> entries = cache.query(new SqlQuery<>(TestBuilderValue.class, "true")).getAll();
assertEquals(2, entries.size());
}
use of org.apache.ignite.binary.BinaryObjectBuilder in project ignite by apache.
the class IgniteCacheAbstractInsertSqlQuerySelfTest method createPerson2.
/**
*/
Object createPerson2(int id, String name, int valFld) {
if (!isBinaryMarshaller()) {
Person2 p = new Person2(id);
p.name = name;
p.IntVal = valFld;
return p;
} else {
BinaryObjectBuilder o = grid(0).binary().builder("Person2");
o.setField("id", id);
o.setField("name", name);
o.setField("IntVal", valFld);
return o.build();
}
}
use of org.apache.ignite.binary.BinaryObjectBuilder in project ignite by apache.
the class IgniteCacheAbstractInsertSqlQuerySelfTest method createPerson.
/**
*/
Object createPerson(int id, String name) {
if (!isBinaryMarshaller()) {
Person p = new Person(id);
p.name = name;
return p;
} else {
BinaryObjectBuilder o = grid(0).binary().builder("Person");
o.setField("id", id);
o.setField("name", name);
return o.build();
}
}
Aggregations