Anthony, No, I don't think so. If you plan to use it from C++, then you will need to configure QueryEntity.
Evgenii пн, 13 апр. 2020 г. в 13:02, Anthony <[email protected]>: > Thank you Evgenii ! BTW, Is there a same thing in c++ ? > > On Mon, Apr 13, 2020 at 9:30 AM Evgenii Zhuravlev < > [email protected]> wrote: > >> Hi, >> >> There is no need to create Query Entity if you already have annotations. >> YOu can add CacheConfiguration.setIndexedTypes(PersonKey.class, >> Person.class) and it will be generated automatically based on you >> annotations. >> >> Evgenii >> >> пн, 13 апр. 2020 г. в 09:11, Anthony <[email protected]>: >> >>> Hello, >>> If I have the following java class: >>> >>> public class Person implements Serializable { >>> /** */ >>> private static final AtomicLong ID_GEN = new AtomicLong(); >>> >>> /** Person ID (indexed). */ >>> @QuerySqlField(index = true) >>> public Long id; >>> >>> /** Organization ID (indexed). */ >>> @QuerySqlField(index = true) >>> public Long orgId; >>> >>> /** First name (not-indexed). */ >>> @QuerySqlField >>> public String firstName; >>> >>> /** Last name (not indexed). */ >>> @QuerySqlField >>> public String lastName; >>> >>> /** Resume text (create LUCENE-based TEXT index for this field). */ >>> @QueryTextField >>> public String resume; >>> >>> /** Salary (indexed). */ >>> @QuerySqlField(index = true) >>> public double salary; >>> >>> /** Custom cache key to guarantee that person is always collocated >>> with its organization. */ >>> private transient AffinityKey<Long> key; >>> >>> >>> And I want to create a table, I need to write the following code in >>> java or put them in the config file. Is it possible to generate them >>> automatically? As Java reflection seems can handle this? >>> >>> CacheConfiguration cacheCfg = new CacheConfiguration("Person"); >>> QueryEntity entity = new QueryEntity(); >>> entity.setKeyType("java.lang.Long"); >>> entity.setValueType("Person"); >>> LinkedHashMap<String,String> map = new LinkedHashMap<String, String>(); >>> map.put("orgId", "java.lang.Long"); >>> map.put("firstName", "java.lang.String"); >>> map.put("lastName", "java.lang.String"); >>> map.put("Resume", "java.lang.String"); >>> map.put("Salary", "java.lang.double"); >>> entity.setFields(map); >>> entity.setIndexes(Collections.singletonList(new QueryIndex("orgId"))); >>> List<QueryEntity> queryEntities = new ArrayList<>(); >>> queryEntities.add(entity); >>> cacheCfg.setQueryEntities(queryEntities); >>> igniteConfiguration.setCacheConfiguration(cacheCfg); >>> Ignite ignite = Ignition.start(igniteConfiguration); >>> IgniteCache cache = ignite.getOrCreateCache("Person"); >>> >>>
