Skip to content

Basic example of the Java DataStax Driver Object Mapper with Cassandra

License

Notifications You must be signed in to change notification settings

phanirajl/object-mapper-java

 
 

Object Mapper in Java

This demonstrates how to use mapper to provide DAO's to access Cassandra

Contributors: Olivier Michallat, derived from here

Objectives

  • 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.

Project Layout

  • MapperApp.java - The main application file

How this Sample Works

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.

Setup and Running

Prerequisites

  • Java 8
  • An Apache Cassandra(R) cluster is running and accessible through the contacts points and data center identified in application.conf

Running

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

About

Basic example of the Java DataStax Driver Object Mapper with Cassandra

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%