e.g. 
public class Student {
        @QuerySqlField(index=true)
        int id;
        @QuerySqlField
        String name ;
        @QuerySqlField
        LocalDateTime dob;
        @QuerySqlField
        LocalDate dos;
        @QuerySqlField
        Map<String, List&lt;Serializable>> map = new HashMap<>();
....
}

Now you can do something like this.


        Ignite ignite = Ignition.start("examples/config/example-ignite.xml");
        CacheConfiguration<Integer, Student> config = new
CacheConfiguration<>("mycache");
        config.setIndexedTypes(Integer.class, Student.class);
        IgniteCache<Integer, Student> cache = ignite.getOrCreateCache(config);
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd
H:mm");
        LocalDateTime time1= LocalDateTime.now();
        String s = time1.format(formatter);
        LocalDateTime time = LocalDateTime.parse(s, formatter);
        Map<String, List&lt;Serializable>> map = new HashMap<>();
        map.put("Key1", Arrays.asList(new Serializable[]{"value1", "value2"}));
        Student s1 = new Student(time, 1, "joe",time.toLocalDate(),map);
        Student s2 = new Student(time, 2, "Lee",time.toLocalDate(),map);
        cache.put(s1.getId(), s1);
        cache.put(s2.getId(), s2);
        SqlQuery<Integer, Student> query = new SqlQuery<>(Student.class, 
"select *
from student where dos =?");
        query.setArgs(time.toLocalDate());
        List<Student> list =
cache.query(query).getAll().stream().map(Cache.Entry::getValue).collect(Collectors.toList());





--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Reply via email to