When I say "set it up correctly for efficient performance", I mean configuring the mapping files. Thats where the majority of performance issue will come from.
Quote:
- if i'm using such a bad configuration of Hibernate variables, why are they the default ones (cause i'm using Hibernate is it came out of the box)? I think you might agree with me that most people don't like to make big configurations in such kinda software. In my opinion Hibernate should plug into the application as it comes and you may make some little adjustments to get better performance.
These mapping files do not come out of the box because they are very specific to your processing. How in the world could Hibernate "plug into an application as it comes"? It needs these mapping files to do its core job.
Quote:
would Hibernate get to 0.45 ms i got with DAO?
OF course not. You'd have to be absurd to think it might in my opinion. This is the quintessential flexibility vs. performance question. As one goes up, the other is going to go down; thats just the nature of the beast. Should you expect it to be that much higher? No. Typically you should expect less than 15% increase.
Quote:
i really appreciate if you tell me what could've been my bottlenecks (even the better hibernate properties).
Like I mentioned above, you did not even include the most important piece of information. Please post the mapping for Person.
But from the code you have posted, I would say that typically performance measurements attempt to isolate the factors they are trying to measure versus the factors they are not. Your tests measurements are also factoring in the amount of time it takes to retreive a JDBC connection during each iteration vs the amount of time needed to build a session during each iteration.
Furthermore, you mention a session facade which to me implies you are retreiving a connection from an app server; that means that jdbcFactory.getConnection() is in all likelihood simply retreiving the same JDBC connection each time, so that would skew your results. You just need to consider whether that is really pertinent to your tests.
Here's a link to a discussion with some general guidelines on doing benchmarks with Hibernate.
http://www.hibernate.org/157.html