I created one application using Spring on Tomcat, and the second app using Java EE (EJB + JSF) on JBoss AS 7. As ORM I choose Hibernate, or I think so.
Suppose, I have a page with trip offers. I can click on a link to load trip descriptions using AJAX.
With the Spring version, after choosing a description link, only one query is sent to the database. This is good.
But with the Java EE version, in the same case, seven queries are sent! Seven queries for each trip offer displayed on the current site. So, if I can see 4 trip offers, there are 4*7 SQL queries! That is why the performance is low.
The service layer, so SQL queries, are the same in both versions. In the Spring version, the request is sent (by post) using jQuery. In Java EE, I use JSF AJAX support.
What is the cause of this behaviour? I am not sure, maybe Hibernate is not really used in the Java EE version? In persistance.xml I have the following: <provider>org.hibernate.ejb.HibernatePersistence</provider>
.