This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes JPA and JDBC, Which one is Performance efficient Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "JPA and JDBC, Which one is Performance efficient" Watch "JPA and JDBC, Which one is Performance efficient" New topic
Author

JPA and JDBC, Which one is Performance efficient

Shayan Shah
Greenhorn

Joined: Aug 28, 2009
Posts: 25
Hi

I am working on an application that needs to be highly performance efficient. We will be having heavy data stored in data bases. And will be having hundreds of requests per minute and for each request will interact with database.

Now JPA ease us from writing SQL and many more, but in this sceneraio, will JPA be that efficient as it adds an extra layer over the JDBC and generates SQL which we can write directly?

Also we have another module that heavily communicates with database, will JPA be performance efficient or JDBC in this case?

Thanks
James Sutherland
Ranch Hand

Joined: Oct 01, 2007
Posts: 553
Most JPA providers are highly optimized and provide many performance features such as caching, batch writing, sequence preallocation, batch fetching, parametrized SQL and many others.

If you had perfectly optimized JDBC and application code, and cached any cacheable data yourself, and took full advantage of every optimization offered by your JDBC driver and database, then you would have better performance than JPA. However most applications are not perfectly optimized, and the more complex the application to more likely the issues. JPA allows easy configuration and optimization of a persistent application, which can lead to better performance. JPA also allows you to spend less time on persistence, so you have more time to spend optimizing your application.

Your performance requirements do not seem like much, so I don't see any issue in using JPA.

TopLink : EclipseLink : Book:Java Persistence : Blog:Java Persistence Performance
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30138
    
150

Shayan Shah wrote:Also we have another module that heavily communicates with database, will JPA be performance efficient or JDBC in this case?Thanks

Impossible to tell. It depends on the requirements of the application.

It is possible to write good/bad JPA and good/bad JDBC. It's hard to compare properly.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Jose Campana
Ranch Hand

Joined: May 28, 2007
Posts: 339
I'm also very interested in this topic.

I would like to kindly ask you about JPA performance myself, particularly about the EclipseLink implementation. The Question is: Is it normal for an Entity Manager to go to sleep so to speak. The scenario I'm worried about is related to that, I noticed that If I leave the Container (OC4J in this case) inactive for a long period of time and then suddenly make an Insert operation, it takes way too long. Checking the Container Console shows that apparently the Resource(Entity Manager) is instantiated again after a long period of inactivity, and this causes a huge delay.

Is this a big concern for a production environment ?

Thanks,

Jose.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JPA and JDBC, Which one is Performance efficient
 
Similar Threads
JPA vs Home Grown JDBC Wrappers
What is the best way to store List<List<String>> in database?
Batch fetching using JPA
Spring JDBC Vs Hibernate?
PL/SQL table values to JDBC