Prepared Statement Handling Different Between 3.2.6 and 3.3 SP1
Description
I'm not sure if this is really a bug per se but when upgrading our code from Hibernate 3.2.6 to 3.3 SP1 I suddenly started to encounter the following exception from Oracle:
java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1
ORA-01000: maximum open cursors exceeded
At first I thought it was directly related to the deprecation of the connection() method as we're doing some manual JDBC access piggybacked off the connection from the currentSession(). After digging around quite a bit and trying to isolate it to a specific location it turned out that we have at least one case where a PreparedStatement that we manually create wasn't being closed which is definitely a bug on our side. What struck me as funny as we hadn't encountered any issue with it previously.
I've attached a simple test case that is simply opening a session and prepared statement, executing it and then not closing it. I can run the test all day long (well, for 1000000+ iterations) w/o a blip with the 3.2.6 release. With 3.3 it maxes out at 500 (our current cursor configuration).
I'm not sure what is different across the 2 versions but you can see from the test, the hold on the cursor exists past the transaction commit and also the close of the session. Closing the statement (the proper thing to do anyways) allows the test to run w/o a hitch.
I just wanted to illustrate that the behavior is different between the 2 releases and ensure that it was intentional and isn't a result of some bug in the internals that I haven't been able to pinpoint.
Environment
Hib 3.3.0 SP1, Oracle 9i with Oracle 11g JDBC driver (11.1.0.6)