22

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.

user392887
  • 1,399
  • 3
  • 9
  • 5
  • 11
    Why this question is closed !!!!!? it is a very nice question with 3390 times views! What do SOF moderators do? – Mehdi Oct 31 '12 at 06:11
  • 5
    This is a very important question, why it is considered not constructive? – nitefrog Feb 08 '14 at 00:17
  • This is still a very relevant question. Most answers point to outdated or non-existent projects! Use either of: [1] Apache Phoenix [2] https://github.com/flipkart-incubator/hbase-orm (disclosure: I am the author of this project) – Manu Manjunath Aug 05 '20 at 07:14

7 Answers7

12

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

vivek mishra
  • 161
  • 1
  • 3
4

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

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

najeeb
  • 813
  • 12
  • 25
4

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.

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.

imyousuf
  • 1,245
  • 2
  • 11
  • 15
3

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

lu wei
  • 31
  • 1
3

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

Cojones
  • 1,906
  • 22
  • 25
2

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.

wlk
  • 5,695
  • 6
  • 54
  • 72
2

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)
Bohdan
  • 21
  • 1