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?
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.
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 ?
subject: JPA and JDBC, Which one is Performance efficient