Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java ORM for Hbase [closed]

Tags:

java

orm

hbase

Anyone knows a good Java ORM implementation for HBase. This one looks really nice for Ruby

http://www.stanford.edu/~sqs/rhino/doc/

But could not find one for Java.

Thanks.

like image 807
user392887 Avatar asked Jul 15 '10 15:07

user392887


7 Answers

Recently a new release of kundera-2.0.4 which is ORM over Hbase. It provides ample of other things which are very useful, like indexing, cross data store persistence etc.

I suggest give it a try https://github.com/impetus-opensource/Kundera

Executable jar is at:

https://github.com/impetus-opensource/Kundera

like image 125
vivek mishra Avatar answered Oct 05 '22 02:10

vivek mishra


The strength of HBase as I see it is in keeping dynamic columns into static column families. From my experience developing applications with HBase I find that it is not as easy as SQL to determine cell qualifiers and values.

For example, a book as many authors, depending on your access patterns, author edits, app-layer cache implementation you might want to choose to save whole author in the book table (that is author resides in 2 table, author table and book table) or just the author id. Further more the collection of author can be saved into one cell as XML/JSON or individual cells for individual authors.

With this understanding I concluded writing a full-blown ORM such as Hibernate will not only be very difficult might not actually be conclusive. So I took a different approach, much more like as iBatis is to Hibernate.

  • My mini-framework: http://github.com/smart-it/smart-dao [smart-hbase]
  • Usage: https://github.com/smart-it/smart-cms [content-spi-impl module has the usages]
  • Usage: https://github.com/smart-it/jetty-session-hbase [hbase-impl module has the usages]

Let me try to explain how it works. For this I will use source codes from here and here.

  1. The first and foremost task is to implement a ObjectRowConverter interface, in this case SessionDataObjectConverter. The abstract class encapsulates basic best practices as discussed and learnt from the HBase community. The extension basically gives you 100% control on how to convert your object to HBase row and vice-versa. For this only restriction from the API is that your domain objects must implement the interface PersistentDTO which is used internally to create Put, Delete, do byte[] to id object and vice versa.
  2. Next task is to wire the dependencies as done in HBaseImplModule. Please let me know if you interested I will go through the dependency injections.

And thats it. How they are used are available here. It basically uses CommonReadDao, CommonWriteDao to read and write data to and from HBase. The common read dao implements multithreaded row to object conversion on queries, multithreaded get by ids, get by id and has its Hibernate Criteria like API to query to HBase via Scan (no aggregation functions available). Common write dao implements common write related code with some added facilities, such as optimistic/pessimistic locking, cell override/merge checking entity (non)-existence on save, update, delete etc.

This ORM has been developed for our internal purpose and I have been upto my neck and hence can not yet do some documentation. But if you are interested let me know and I will make time for documentation with priority.

like image 22
imyousuf Avatar answered Oct 05 '22 02:10

imyousuf


Hibernate OGM is a fine solution for non SQL Databases. Try it out.

http://www.hibernate.org/subprojects/ogm.html

like image 43
najeeb Avatar answered Oct 05 '22 01:10

najeeb


How about datanucleus: you can use JPA or JDO as your API and hbase as the backend store: http://www.datanucleus.org/plugins/store.hbase.html

like image 38
Cojones Avatar answered Oct 05 '22 02:10

Cojones


you can try this: http://code.google.com/p/hbase-ormlite/ . This is a orm for HBase in Java.

like image 24
lu wei Avatar answered Oct 05 '22 02:10

lu wei


There is pigi and parhely and I have used none of them. IMO HBase is fast key/value store engine, but if you need another layer of abstractions, you should check them out.

like image 36
wlk Avatar answered Oct 05 '22 02:10

wlk


We are using HBase ORM - Surus https://github.com/mushkevych/surus/wiki

Probably worth mentioning

  • we are using it heavily with Hadoop map/reduce
  • it has extra module that allows you to pump into HBase data from JSON stream (in our case it comes from Python code)
like image 41
Bohdan Avatar answered Oct 05 '22 02:10

Bohdan