Demo of some data access of cassandra with some datastax libraries.
Do the following to get Cassandra working on your machine:
- Download Cassandra and install
- Start up Cassandra: "cassandra -f" will start it up in the foreground so you don't forget about it
- Add the datastax dependencies to your project
- In order to create a table you can use, you first need to create a keyspace
- Then you can create you table and insert data into it; running this script will create the keyspace, table, and load the data
- To run the script included in this project, run the following command: "cqlsh -f person-create.cql"
The java program has examples of
- Usage of a mapper for querying individual records and collections using the Person model The annotations on Person are
- @Table
- @Column (required if the column name in the db is different then the name of the field on the Model)
- @PartitionKey
- Doing an Insert with a mapper
- Using a QueryBuilder and ResultSet
I just put this together so I would have some notes to remember a video I just watched on Safari Books Online: Mastering Cassandra Essentials.