Hi,
My question involves the caching of prepared statements, which always seems like something of a mystery.
Here's the background: My workgroup has never used either an O/R mapping tool or a J2EE container. We write JDBC, and we have a custom built connection pool that does not conform to any standard JDBC interface. Since no other connection pool was available in my environment and since I wanted to introduce Hibernate with a minimum of disruption, I modified the custom pool to implement the Hibernate ConnectionProvider interface, and passed it to Hibernate as a data source.
Here's the rub: my custom pool caches prepared statements, and it has explicit functions for getting and saving prepared statements. Obviously Hibernate isn't calling these functions since it doesn't know about them.
Does this mean that there is no caching of prepared statements? I have long assumed that this happened automatically at the level of the JDBC driver; I use Oracle, and have a fairly recent version of the thin driver in my environment. I've never seen anyone explicitly cache prepared statements before, so I figured that this was simply handled automatically by the JDBC driver. But I suppose it could be that it is normally handled by a J2EE container's connection pool, the benefits of which aren't available to me in this situation.
Any feedback would be appreciated, thanks.
Frank
|