As I had written in title, I am trying to learn Spring 3.0 (I already know Django, Pylons and few simpler MVC frameworks) and try to use Cassandra as a backend for my web application.
Are there any real world examples of doing this? Or maybe some tutorials? I know about the existence of documentation of both technologies, yet I am looking for something "faster" to read and get me rolling.
I'm the author of Hector https://github.com/rantav/hector, the leading java client for cassandra so I would encourage you to have a look at what it has to offer.
While I personally have not been using hector with spring, we did get a few contributions which added spring support. See for example https://github.com/rantav/hector/blob/master/core/src/test/resources/cassandra-context-test-v2.xml and https://github.com/rantav/hector/blob/master/core/src/test/resources/cassandra-context-test-v2-new.xml
If you are already familiar with MVC frameworks then you should be aware that which database/datastore you use in the backend shouldn't impact your MVC application as a whole, or how you structure things - it should only affect your data layer and how it retrieves data.
With Spring MVC, the accepted practice is that you represent your data model as a series of "domain model / classes", which are typically just POJOs to hold your data. "Domain" here means that it is related to your problem domain; so if you have an application which deals with customers ordering things you'd want to have a Customer
class, an Order
class, etc.
Each of the three layers of your MVC application - the controllers, the service/business logic layer, and the DAO layer interacts with these domain model classes. Since the DAO layer is responsible for retrieving or updating this data in the backend, this means it is the DAO layer which needs to know how to fetch your Customer
or Order
class from Cassandra, how to update certain Customer
fields, etc.
So there is nothing special about how you would build your Spring MVC application itself when using Cassandra or any other "NoSQL" database. You'll just need to provide different implementations of your DAO classes which can communicate with Cassandra.
If you are asking if there are any pre-built Spring utilities that can access Cassandra (or Thrift) then the answer is no, at least as far as what's in Spring 3.0. But this should be pretty simple to write once you have the DAO interface set and all other layers of your application in place.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With