use of org.apache.ignite.cache.QueryEntity in project ignite by apache.
the class IgniteCacheDuplicateEntityConfigurationSelfTest method testClassDuplicatesQueryReverse.
/**
* @throws Exception If failed.
*/
public void testClassDuplicatesQueryReverse() throws Exception {
String cacheName = "duplicate";
CacheConfiguration ccfg = new CacheConfiguration(cacheName);
QueryEntity entity = new QueryEntity();
entity.setKeyType(Integer.class.getName());
entity.setValueType(Person.class.getName());
LinkedHashMap<String, String> fields = new LinkedHashMap<>();
fields.put("name", String.class.getName());
entity.setFields(fields);
ccfg.setQueryEntities(Arrays.asList(entity));
ccfg.setIndexedTypes(Integer.class, Person.class);
try {
ignite(0).getOrCreateCache(ccfg);
} finally {
ignite(0).destroyCache(cacheName);
}
}
use of org.apache.ignite.cache.QueryEntity in project ignite by apache.
the class BinarySerializationQuerySelfTest method entityForClass.
/**
* Create type metadata for class.
*
* @param cls Class.
* @return Type metadata.
*/
private static QueryEntity entityForClass(Class cls) {
QueryEntity entity = new QueryEntity(Integer.class.getName(), cls.getName());
entity.addQueryField("val", Integer.class.getName(), null);
entity.setIndexes(Collections.singletonList(new QueryIndex("val", true)));
return entity;
}
use of org.apache.ignite.cache.QueryEntity in project ignite by apache.
the class IgniteBinaryObjectQueryArgumentsTest method getCacheConfiguration.
/**
* @param cacheName Cache name.
* @return Cache config.
*/
protected CacheConfiguration getCacheConfiguration(final String cacheName) {
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
ccfg.setWriteSynchronizationMode(FULL_SYNC);
QueryEntity person = new QueryEntity();
person.setKeyType(TestKey.class.getName());
person.setValueType(Person.class.getName());
person.addQueryField("name", String.class.getName(), null);
ccfg.setQueryEntities(Collections.singletonList(person));
ccfg.setName(cacheName);
return ccfg;
}
use of org.apache.ignite.cache.QueryEntity in project ignite by apache.
the class IgniteCacheAbstractSqlDmlQuerySelfTest method createBinCacheConfig.
/**
*/
private static CacheConfiguration createBinCacheConfig() {
CacheConfiguration ccfg = cacheConfig("S2P-bin", true, false);
QueryEntity e = new QueryEntity(String.class.getName(), "Person");
LinkedHashMap<String, String> flds = new LinkedHashMap<>();
flds.put("id", Integer.class.getName());
flds.put("firstName", String.class.getName());
flds.put("secondName", String.class.getName());
e.setFields(flds);
e.setIndexes(Collections.<QueryIndex>emptyList());
ccfg.setQueryEntities(Collections.singletonList(e));
return ccfg;
}
use of org.apache.ignite.cache.QueryEntity in project ignite by apache.
the class IgniteCacheGroupsSqlTest method accountCacheConfiguration.
/**
* @param grpName Group name.
* @param cacheName Cache name.
* @return Account cache configuration.
*/
private CacheConfiguration accountCacheConfiguration(String grpName, String cacheName) {
QueryEntity entity = new QueryEntity();
entity.setKeyType(AffinityKey.class.getName());
entity.setValueType(Account.class.getName());
entity.addQueryField("personId", Integer.class.getName(), null);
entity.addQueryField("attr", String.class.getName(), null);
entity.setIndexes(F.asList(new QueryIndex("personId")));
return cacheConfiguration(grpName, cacheName, entity);
}
Aggregations