cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Atul Saroha <atul.sar...@snapdeal.com>
Subject Re: ORM layer for cassandra-java?
Date Fri, 12 Feb 2016 08:02:16 GMT
Thanks Doan,

We are now evaluating or nearly finalized to use Achilles.

We are looking for one use case.
As I mentioned in above for static columns.

> CREATE TABLE IF NOT EXISTS  ks.PrimeUser(
>   id int,
>   c1 text STATIC,
>   c2 boolean STATIC,
>   c3 text,
>   c4 text,
>   PRIMARY KEY (id, c3)
>
);
>
How could I achieve Delta Update through this ORM  where I want to
inserting one row for id,c3,c4 columns only or updating one row for c4
column only against ( id,c3). If I use my entity PrimeUser.java and crud
insert method then it will insert all columns including static.
I think that there is only one way which is to use update method of
dsl/Query API. Since Achilies does not have persistence context like
hibernate does, to track what has beed updated in my java entity and update
the change only though DynamicUpdate anotation.
Or there is something I am missing here?.

Thanks , reply will be highly appreciated


---------------------------------------------------------------------------------------------------------------------
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

On Tue, Feb 9, 2016 at 8:32 PM, DuyHai Doan <doanduyhai@gmail.com> wrote:

> 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.saroha@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
>>
>
>

Mime
View raw message