[Umm, there was an accidental premature post event there. As I was saying...]
...the take home point here is this: when you're not using a Connection pool, there's only one Connection in your application, and your CallableStatement eventually gets commit()ed if any work gets commit()ed (unless something explicitly fails and there's a rollback()). but this is fragile -- you are not doing anything to ensure that your CallableStatement gets committed, you are just getting lucky.
when using a Connection pool, hibernate is working with many different Connections, checking them in and out as-needed. so you no longer get lucky. you ask your Session for a Connection at one moment in your application, do some work that requires a commit(), but you don't commit() explicitly, and you don't do anything that forces hibernate to commit() for you before it releases the Connection.
again, hibernate jockeys might be able to give you better advice, but here are some ideas 1) call commit() directly on the Connection after your CallableStatement (but going underneath hibernate like this might clash with hibernate's transaction management); or 2) begin an explicit transaction on your Session object prior to calling connection() and doing your jdbc work, and use hibernate's transaction interface to commit the transaction after your callable statement work. Stealing and modifying from
http://www.hibernate.org/hib_docs/v3/reference/en/html/transactions.html, it'd be something like...
Code:
Transaction tx = null;
try
{
tx = session.beginTransaction();
// do some work
Connection conn = session.connection();
CallableStatement cs = conn.prepareCall( MY_STORED_PROC_CALL );
cs.execute();
tx.commit();
}
catch (Exception e)
{
if (tx != null) tx.rollback();
throw e; // or display error message
}
finally
{
session.close();
}
good luck! hope this helps!
Steve