How to Define Entity with Multiple Partition key and Cluster Keys

31 views
Skip to first unread message

Raj

unread,
Feb 16, 2017, 3:11:10 PM2/16/17
to kundera-discuss




I am trying to use Kundera for connecting to Cassandra. In my case I have an Entity X with Partition Key {A,B} and cluster key {C}.

We have multiple values of C for each A and B combination(primary key).

So in such case how should be define the entity?

@Embeddable
public class PrimayKey implements Serializable{

 @Column(name = "A")
     private String a;

     @Column(name = "B")
     private String b;
}




@Entity
@Table(name = "X")
public class X{


    @EmbeddedId
    private PrimayKey key;

    @Column(name = "C")
    private String c;

   @Column(name = "D")
    private String d;
}

Here if I go for a find by Primary Key its not working as we have multiple values of C and D for each A and B combination. In such case how should we define entity?

karthik prasad

unread,
Feb 19, 2017, 10:23:37 PM2/19/17
to kundera-discuss
Reply all
Reply to author
Forward
0 new messages