views:

215

answers:

7

Which Java ORM is considered the most performant generally speaking?

I realize this could mean less features, but just want an idea.

A: 

The most widely used ORM is by far hibernate (the one you so nicely tagged)

This question could also be a duplicate of this: Statistics on ORM

Shervin
The question is actually about performance, not about popularity.
BalusC
I see. My bad. Must learn to read question
Shervin
+5  A: 

A few years ago, at the place I was working, we spend some time comparing the performance of plain JDBC, Hibernate, TOPLink and Weblogic CMP for typical usecases (fetch, updates, join fetches, partial fetches etc). Hibernate, TOPLink or Weblogic CMP did not add any significant overhead over plain JDBC. Hibernate had a minor performance issue, but that turned out to be a bug in Oracle's driver (and the team implemented a workaround too).

Having said that, I should add that making these tools perform well was non-trivial - one should have a good understanding of what is happening under the covers and be familiar with the configuration parameters. Also, it is very easy to generate bad queries (N+1 problems, for example) with ORMs.

Eventually we chose Hibernate because we liked its programing model (it is very non-intrusive) better and because it was free (as in beer).

binil
You really have to understand what's going on under the hood. Take the 'best' ORM and use it terribly and you will get terrible performance!
Guillaume
A: 

I would second the vote on Hibernate as the most popular ORM out there for Java. It performs well and is quite mature. I would caution you to consider that other issues probably bury ORM performance issues. That is, the ORM is usually not going to be your bottleneck assuming you configure and use it properly.

Tom Cabanski
+1  A: 

Ujorm claims to be the most performant. Honestly, I've never heard about it before, Google just popped it.

Regardless, it depends on the environment and the functional requirements. Measuring is knowing. I wouldn't expect the differences being shocking huge. All self-respected ORM frameworks and implementations can be tuned to extreme. I would after all prefer a known, clear and concise API above an obscure API and performance. As far now JPA(2) excels in this.

BalusC
+1  A: 

Define performance ? Performance on the typical operations that your operations requires would make most sense, so it is for you to define your persistence layer operations. JDO is the most configurable standardised API, whilst JPA is most commonly used (with little opportunity to tune it). DataNucleus provides both. If you have operations like PolePosition benchmark then DataNucleus performs very well relative to the competing solutions (with tuning on all); but then that benchmark doesn't necessarily perform your typical operations.

DataNucleus
Where are the public results of the competing solutions with the PolePosition benchmark? Who did the tuning?
Pascal Thivent
A colleague ran them for JPOX (just before changing name to DataNucleus - 2 yrs ago), Hibernate 3, and Kodo and put the results at http://www.jpox.org/servlet/wiki/display/ENG/PoleposThink he put the input used in JPOX SVN (on SourceForge).
DataNucleus
I checked the PolePosition benchmark and: 1. It's not an independent benchmark (created by the guys from db4o) 2. Hibernate is clearly under optimized (I would even say deoptmized) 3. Any vendor can find a biased benchmark on which his product looks "better" than competing products. In other words, it's not credible at all in my eyes.
Pascal Thivent
Any benchmark that is open source is open to scrutiny, and creating it is a worthwhile activity, worthy of way more than just being dissed. Anybody can optimise a particular persistence solution and run it; couldn't you. As already said to the poster, they ought to find benchmarkable operations representative of their applications and use that; whether PolePos contains such operations is for the poster to decide.
DataNucleus
I've been running several big to huge applications using Hibernate (to name it) in production and *none* of them suffers from the supposed problems outlined in the PolePosition benchmark. Claiming that Hibernate is tuned is just a lie, that's my point. And I don't have time to lose with buggy benchmarks, as I said, Hibernate performs really well for me, as proven by the benchmarks *I* run.
Pascal Thivent
You just repeated the words of the Hibernate team for two posts in a row; thanks for that. My response was for the benefit of the user who requested assistance, to look at benchmarks objectively and assess them for his application. And please don't call me a liar, its offensive, I simply pass on the information I was given.
DataNucleus
Hmm... what? I'm not affiliated to Hibernate and the opinion expressed above is only mine, it reflects *my* experience of hibernate, of benchmarks (and I have some solid experience in that field and also of vendors), and of the testing *I* did with the PolePosition bench this weekend after being heavily surprised by its results. If there is some convergence with other opinions, it's maybe because of evidence. Now, to be clear, I don't call you a liar and Hibernate has flaws but saying that Hibernate is tuned on this bench is not true.
Pascal Thivent
A: 

The problem with your question is the "generally speaking". There is no such thing, there is no "general" application. Each application has its own object model and requests and the performances obtained with one particular ORM wouldn't be necessarily transposable to another application (in other words, another application may perform better with another ORM solution).

So, if you want to find an answer to your question, bench the various ORMs on your application. This is not so hard to do if you're using JPA and if you're not using proprietary extensions (note that changing the JPA provider doesn't prevent you from having to tune it). It will require more efforts to include other ORM solutions.

Pascal Thivent
A: 

Hibernate is by far the most popular option. This is particularly nice when requiring support from a very large community. However, it also has its shortcomings -- like batch inserts. It really depends on what you're looking to do and what kind of performance you need. In general Hibernate is very fast.

artgon