We are using Glassfish server 2.1 with Eclipselink JPA 2.1 and connect to a PostgreSQL database 8.4.8.
The problem is that in the log file of Postgres I always see a prepare of the statements that were created with em.createQuery or em.createNamedQuery.
It seems that no statement that has been prepared is reused. Therefore the performance is really bad.
I tried setting the default JDBC setting prepareThreshold from 5 to 1.
That only changed that the unnamed statements were now named. But they were still not reused.
I also tried several settings for the connection pooling as prepared statements are connection dependent but returned to the default org.postgresql.ds.PGSimpleDataSource and javax.sql.DataSouce.
I enabled statement caching also in the persistence.xml:
<property name="eclipselink.jdbc.cache-statements" value="true"/>
Does Glassfish 2.1 support statement caching? And if it does what are the settings I missed?
Any hints appreciated.
Considering this: http://www.youtube.com/watch?v=hfx_M0p0KoM it seems that 2.1 does not support statement caching.