java - How to create composite primary key scenario in Gemfire region? -


i working on migration of mainframe java. have 1 table in db2. replicating table region in gemfire. while doing this, have composite primary key table. replicate table gemfire region. want make composite primary key region. want know that, there possibility create composite primary key in region?

ideally, creating keys not change in value after key/value pair "put" region. gemfire/geode region glorified version of java.util.map (and hashmap precise).

this means "composite" key should not based on property values in region value itself. way of example, imagine have value customer defined so...

class customer {    long accountnumber;    gender gender;    localdate birthdate;    string firstname;   string lastname;    ... } 

it inadvisable create key so...

class customerkey {    localdate birthdate;    string firstname;   string lastname;  } 

while person's birth date, first , last name enough uniquely identify someone, if of these individual property/field values change lose pairing given intrinsic behavior of java map (so careful).

you should take care craft equals/hashcode methods of "custom/composite" key class create.

i recommend use internal (only known application), scalar types keys, e.g. long or string.

this simple adding property/field customer class so...

class customer {    long id;    ...  } 

most of time, (oql) query predicates based on values of individual domain object properties/fields, not keys. example...

select c /customers c c.lastname = 'doe' 

additionally, if key string, use uuid class generate unique values. otherwise, need craft own unique, key generation strategy.

in summary, while asking possible given crafted class types in java, not recommended; prefer simple, scalar types.

here link things in general keep in mind.

hope helps.

-john


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -