Domanda

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.

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top