Вопрос

I'm using Hazelcast to save map Object Class which has many properties with difference types

Example

  public class Person() {
      public int id;
      public Syting name;
      public Date birthDay;
      public boolean isVip;
  }

So, how i can put map with object data and hazelconfig.xml as

  <indexes>
            <index ordered="true">id</index>
            <index ordered="true">name</index>
            <index ordered="false">birthDay</index>
            <index ordered="false">isVip</index>
  </indexes>

Thank you very much for any ideas.

Это было полезно?

Решение

You can just add your person to a map with the configured indexes.

Map personMap = hz.getMap("persons"):
personMap.put("1", new Person(.......))

Hazelcast will inspect the object and check if there are any fields/methods which match with the index definitions.

PS: Why would you need ordered index on name of id? Unordered index is faster AFAIK.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top