Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hibernate vs ebean as scalable, performant ORM

We are going to write a service for which we are trying to evaluate technology stack. So as part of ORM we are thinking of using hibernate but from one of my colleague I came to know abt ebean. But we don't have any idea of ebean.

So my question is: Is there any disadvantage associated to hibernate, any salability or performance bottleneck? And what is the advantage ebean brings to the table?

like image 892
Trying Avatar asked Jun 19 '14 19:06

Trying


3 Answers

What does Ebean bring to the table?

In short with Ebean it brings a full function ORM that is a lot easier to use and most importantly optimize (Well, it is easy but can also be done automatically via profiling).

  • A query language designed to optimise object graph construction via good support for Partial Objects and built in avoidance of N + 1

  • A "Sessionless" ORM ... architected to not have attach/detach semantics (So this makes it easier to use / fast to master).

Ebean now has SQL2011 History support and ElasticSearch integration. You could argue Hibernate has similar features.

Reference links:

  • ElasticSearch http://ebean-orm.github.io/docs/features/elasticsearch/
  • Automatic query tuning http://ebean-orm.github.io/docs/query/autotune
  • N + 1 http://ebean-orm.github.io/docs/query/nplus1
like image 100
Rob Bygrave Avatar answered Nov 18 '22 13:11

Rob Bygrave


There are lot of issues with hibernate and basically any implementation of JPA in large and very scalable application. You should consider use another solution at all. Issues are well described in article Large Application Model issues and how model should look like in article Model for large applications.

like image 26
Jakub Riedl Avatar answered Nov 18 '22 12:11

Jakub Riedl


As it is mentioned before, Ebean is sessionless ORM so you don't need to think about sessions. Hibernate has first level cache which is impossible to disable. It means that if you query item through ORM and then delete it directly with SQL, it stays in the cache. You can explicitly clear the cache to get the most updated results from database but unfortunately such behavior may bring errors like "detached entity passed to persist".

like image 39
Justinas Jakavonis Avatar answered Nov 18 '22 11:11

Justinas Jakavonis