-
Notifications
You must be signed in to change notification settings - Fork 233
Embedded super columns in Cassandra
chhavigangwal edited this page Nov 6, 2013
·
5 revisions
In order to add more dimensions to traditional key value (row -column) model of Cassandra, you can create further sub-columns in a column. This can be done by embedding super columns in Cassandra using thrift.
This can be achieved using Kundera. Following is an example :
@Entity
@Table(name = "USER", schema = "KunderaExamples@twissandraTest")
public class UserCassandra
{
@Id
@Column(name = "USER_ID")
private String userId;
// Embedded object, will persist co-located
@Embedded
private PersonalDetailCassandra personalDetail;
// Embedded object, will persist co-located
@Embedded
private ProfessionalDetailCassandra professionalDetail;
@Embeddable
@IndexCollection(columns = { @Index(name = "name"), @Index(name = "relationshipStatus") })
public class PersonalDetailCassandra
{
@Column(name = "personal_detail_id")
private String personalDetailId;
@Column(name = "person_name")
private String name;
@Column(name = "person_password")
private String password;
@Column(name = "rel_status")
private String relationshipStatus;
@Embeddable
@IndexCollection(columns = { @Index(name = "professionId"), @Index(name = "departmentName"),
@Index(name = "isExceptional"), @Index(name = "age"), @Index(name = "grade"),
@Index(name = "digitalSignature"), @Index(name = "rating"), @Index(name = "compliance"),
@Index(name = "height"), @Index(name = "enrolmentDate"), @Index(name = "enrolmentTime"),
@Index(name = "joiningDateAndTime"), @Index(name = "yearsSpent"), @Index(name = "uniqueId"),
@Index(name = "monthlySalary"), @Index(name = "birthday"), @Index(name = "birthtime"),
@Index(name = "anniversary"), @Index(name = "jobAttempts"), @Index(name = "accumulatedWealth"),
@Index(name = "graduationDay") })
public class ProfessionalDetailCassandra
{
// Primitive Types
@Column(name = "PROFESSION_ID")
private long professionId;
@Column(name = "DEPARTMENT_NAME")
private String departmentName;
@Column(name = "IS_EXCEPTIONAL")
private boolean isExceptional;
@Column(name = "AGE")
private int age;
@Column(name = "GRADE")
private char grade; // A,B,C,D,E,F for i to vi
@Column(name = "DIGITAL_SIGNATURE")
private byte digitalSignature;
@Column(name = "RATING")
private short rating; // 1-10
@Column(name = "COMPLIANCE")
private float compliance;
@Column(name = "HEIGHT")
private double height;
Cassandra Equivalent :
CREATE TABLE "USER" (
key text,
column1 text,
value blob,
PRIMARY KEY (key, column1)
) ;
-
Datastores Supported
- Releases
-
Architecture
-
Concepts
-
Getting Started in 5 minutes
-
Features
- Object Mapper
- Polyglot Persistence
- Queries Support
- JPQL (JPA Query Language)
- Native Queries
- Batch insert update
- Schema Generation
- Primary Key Auto generation
- Transaction Management
- REST Based Access
- Geospatial Persistence and Queries
- Graph Database Support
-
Composite Keys
-
No hard annotation for schema
-
Support for Mapped superclass
-
Object to NoSQL Data Mapping
-
Cassandra's User Defined Types and Indexes on Collections
-
Support for aggregation
- Scalar Queries over Cassandra
- Connection pooling using Kundera Cassandra
- Configuration
-
Kundera with Couchdb
-
Kundera with Elasticsearch
-
Kundera with HBase
-
Kundera with Kudu
-
Kundera with RethinkDB
-
Kundera with MongoDB
-
Kundera with OracleNoSQL
-
Kundera with Redis
-
Kundera with Spark
-
Extend Kundera
- Sample Codes and Examples
-
Blogs and Articles
-
Tutorials
* Kundera with Openshift
* Kundera with Play Framework
* Kundera with GWT
* Kundera with JBoss
* Kundera with Spring
-
Performance
-
Troubleshooting
-
FAQ
- Production deployments
- Feedback