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