문제

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