SQL Zone is brought to you in partnership with:

Sheikh has posted 1 posts at DZone. You can read more from them at their website. View Full User Profile

OrientDB - Pure Java NoSQL Datastore

  • submit to reddit

I have been following the so-called 'NoSQL movement' (as if such a movement exists!). In my opinion, it is just another way of storing and retrieving data. And this new (rather different, I am sure the method is not new) way is only suitable for certain types of applications. Not all applications require NoSQL-type storage and retrieval regardless of those who claim it to be. SQL and NoSQL complement each other. They are not rivals.

Having said that, I was pretty much interested in the concepts. I love trying out new things. While I was planning the design and architecture of a new open source project that I intend to develop (It is not exactly new. I have already started it but now plan to move it to a new architecture - Greenscape), one of the choices I had to make was on the data storage. My application will be highly dynamic with ability of end users to add and remove columns to a database table frequently. Doing it in relational database will incur heavy performance and complexity. After much consideration, I decided that a non-relational database will be the best choice for my application. But this choice is not without its share of challenges:

  1. I lose JPA/Hibernate support which means I may have to come up with an equivalent framework.
  2. I lose portability. NoSQL is non-standard. There is no standard query language. There are no standard protocol. So, tomorrow, I cannot replace the database with a better performing one without rewriting my application.
  3. Few documentation. What are the best practices, design patterns, etc?

In spite of the challenges, I went ahead with my choice. The compelling reason was the ability to create knowledge because of the void.

Now that the decision was made, I had to choose a NoSQL database. I analysed all the popular ones but none fitted my requirements. I had one criteria for selecting a database: I must be able to code in Java. Most available systems were non-Java based which would be a significant issue for a one man project. Even if they had Java interface, the installation, setup, etc. were a tedious process. Having a database developed purely in Java has many advantages:

  1. Easy packaging with other applications
  2. Easy to install and run
  3. Can be embedded
  4. Can run in same or different VM
  5. Easy to debug
  6. Easy to test

After much searching, I came across OrientDB. Voila! That was what I needed! Going through its features only reinforced by belief in it. It is a pure Java solution and very small in size (500KB! 2MB since last release) . It can be embedded as well as deployed in networked mode. It is both schema-less and schema-based! This topped the feature list. It also supports SQL as a query language (Hmm, need to call NoSQL by some other name).

Some of the features taken from its homepage:

  1. SQL
  2. Super fast
  3. Transactional
  4. GraphDB
  5. Web ready (HTTP, REST, JSON)
  6. Everywhere (Pure Java)
  7. Extremely light
  8. Apache License (Here's the money)

End of architecture choice 1 for Greenscape.
Next decision on application framework pending.

Published at DZone with permission of its author, Sheikh Sajid.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


Andy Jefferson replied on Wed, 2011/06/15 - 2:11pm

Errrm you can also persist/query it using JDO or JPA, using a plugin for DataNucleus so no need to just throw away your existing persistence model and code. And then if portability is a big thing to you, there are also (DataNucleus) plugins for MongoDB, Cassandra, HBase, and GAE/J BigTable - you won't get that with Hibernate

darryl west replied on Wed, 2011/06/15 - 3:28pm

I don't think that there is an OrientDB plugin for grails yet, but there is a great one for MongoDB. My guess is that all the major NoSQL dbs will get grails plugin support.

Sheikh Sajid replied on Thu, 2011/06/16 - 12:17am in response to: Andy Jefferson

Hmmm...I haven't been googling, it seems :) otherwise, would have got those links. Thanks! Will definitely look into those.

Jakub M replied on Fri, 2011/06/17 - 3:52am

I would only ask you to read your own article again very carefully and post and update as of why do you think it is very mediocre at best. I'm not going to do it for you as I'm tired of educating guys like you.

Luca Garulli replied on Mon, 2011/07/25 - 9:36am

Many users are using OrientDB directly with Grails since the good news is that Groovy is based on JVM and OrientDB is written in Java, so no driver is needed! Lvc@

Ian Mayo replied on Thu, 2011/12/01 - 8:29am

Sheikh, I see from the GreenSpace page that you ended up using Apache Derby. Would you mind sharing with us the "issues" that lead you to move away from OrientDb?

Sheikh Sajid replied on Mon, 2013/10/21 - 12:35am in response to: Ian Mayo

 I did not move away from OrientDB. But I intended to move to OrientDB. That Greenscape project is a old one based on Derby that I want written using OrientDB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.