This demonstrates how to use mapper to provide DAO's to access Cassandra
Contributors: Olivier Michallat, derived from here
- To demonstrate how to use mapper to replace the tedious work DAO recreation in Java. Please refer here for more details on using object mapper.
- MapperApp.java - The main application file
The mapper interface is the top-level entry point to mapping features. It wraps a core driver session, and acts as a factory of DAO objects that will be used to execute requests. This app creates a top level mapper in the default keyspace killrvideo. This mapper interface acts as a factory to create and maintain the
- userDAO
- videoDAO
These two DAO's are used to interact with the Cassandra cluster.
- Java 8
- An Apache Cassandra(R) cluster is running and accessible through the contacts points and data center identified in application.conf
e.g. To run this application use the following command:
mvn exec:exec
This will create a new keyspace killrvideo and many tables in the keyspace:
Insert rows into the users, videos and the other tables