I want to use cassandra, but I did not use the relationship @onetomany or @ManyToMant. I use java and cassandra-core driver. How can I use these relationships
Asked
Active
Viewed 1,701 times
1 Answers
6
You don't. You denormalize data into multiple tables, and sometimes you query multiple tables and join on the client side. Sometimes you can also query, and based on the results, query other tables (i.e. lookup).
A big thing in cassanddra is the idea of query driven modelling. You can start modelling with your one to many or many to many model, and from there think about how the data is going to be accessed. Based on that, create a logical model thinking of cassandra tables as "materialised views". Then factor in performance considerations like partition and clustering keys, secondary indexes, query paths, etc. Based on that, build you physical data model.

ashic
- 6,367
- 5
- 33
- 54
-
To add to my earlier answer, you can also use collection columns. Cassandra supports lists, sets and maps. For "smaller" amounts of nested data, they're useful for denormalising some information from other tables (or whatever) into collection columns. – ashic Dec 01 '14 at 14:33