Look at Achilles and how it models Partition key & clustering columns: https://github.com/doanduyhai/Achilles/wiki/5-minutes-Tutorial#clustered-entities
On Tue, Feb 9, 2016 at 12:48 PM, Atul Saroha <atul.sar...@snapdeal.com> wrote: > I know the most popular ORM api > > 1. Kundera : > > https://github.com/impetus-opensource/Kundera/wiki/Using-Compound-keys-with-Kundera > 2. Hector (outdated- no longer in development) > > I am bit confuse to model this table into java domain entity structure > > CREATE TABLE IF NOT EXISTS ks.PrimeUser( > id int, > c1 text STATIC, > c2 boolean STATIC, > c3 text, > c4 text, > PRIMARY KEY (id, c3) > ); > > > One way is to create compound key based on id and c3 column as shown > below. > >> @Entity >> @Table(name="PrimeUser", schema="ks") >> public class PrimeUser >> { >> >> @EmbeddedId >> private CompoundKey key; >> >> @Column >> private String c1; >> @Column >> private String c2; >> @Column >> private String c4; >> } >> >> Here key has to be an Embeddable entity: >> >> @Embeddable >> public class CompoundKey >> { >> @Column private int id; >> @Column private String c1; >> } >> >> Then again when we fetch the data based on id only then c1 and c2 will be > duplicated multiple times object, even though they are stored per "id" > basis. c3 column is cluster key and its corresponding value is mapped to > column c4. We avoid using map<c3,c4> here as it will cause performance hit. > Also he have use cases to fetch the data based on (b1,c3) both also. > > Is there any other ORM API which handle such scenario. > > > > > --------------------------------------------------------------------------------------------------------------------- > Atul Saroha > *Sr. Software Engineer* > *M*: +91 8447784271 *T*: +91 124-415-6069 *EXT*: 12369 > Plot # 362, ASF Centre - Tower A, Udyog Vihar, > Phase -4, Sector 18, Gurgaon, Haryana 122016, INDIA >