We have a web application running in a production enviroment and at some point the client complained about how slow the application got.
When we checked what was goi
As pointed out by @BalusC, this query is performed during schema validation. But validation is usually done once for all when creating the SessionFactory (if activated). Do you call the following method explicitely: Configuration#validateSchema(Dialect, DatabaseMetadata)?
Now, is that correct? It's there a way for me to configure the OC4J for it to instantiate filters only once?
Your implementation of the Open Session In View looks fine (and is very close to the one suggested in this page). And according to the Servlet specification only one instance per declaration in the deployment descriptor is instantiated per Java Virtual Machine (JVMTM) of the container. Since it is very unlikely that this isn't the case with OC4J, I'm tempted to say that there must something else.
Can you put some logging in the filter? What about making the SessionFactory static (in a good old HibernateUtil class)?