From: <one...@us...> - 2003-03-04 10:43:10
|
Update of /cvsroot/hibernate/Hibernate/cirrus/hibernate/loader In directory sc8-pr-cvs1:/tmp/cvs-serv31778/hibernate/loader Modified Files: Loader.java Log Message: fixed problem with cached prepared statement handling Index: Loader.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate/cirrus/hibernate/loader/Loader.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** Loader.java 15 Jan 2003 12:52:40 -0000 1.34 --- Loader.java 4 Mar 2003 10:43:06 -0000 1.35 *************** *** 211,215 **** } finally { ! session.getBatcher().closeQueryStatement(st); } } --- 211,215 ---- } finally { ! closePreparedStatement(st, selection, session); } } *************** *** 430,438 **** catch (SQLException sqle) { JDBCExceptionReporter.logExceptions(sqle); ! session.getBatcher().closeQueryStatement(st); throw sqle; } catch (HibernateException he) { ! session.getBatcher().closeQueryStatement(st); throw he; } --- 430,438 ---- catch (SQLException sqle) { JDBCExceptionReporter.logExceptions(sqle); ! closePreparedStatement(st, selection, session); throw sqle; } catch (HibernateException he) { ! closePreparedStatement(st, selection, session); throw he; } *************** *** 441,444 **** --- 441,456 ---- } + protected final void closePreparedStatement(PreparedStatement st, QueryImpl.RowSelection selection, SessionImplementor session) throws SQLException, HibernateException { + try { + if (selection!=null) { + if (selection.maxRows!=null) st.setMaxRows(0); + if (selection.timeout!=null) st.setQueryTimeout(0); + } + } + finally { + session.getBatcher().closeQueryStatement(st); + } + } + /** * Limit the number of rows returned by the SQL query if necessary *************** *** 464,471 **** catch (SQLException sqle) { JDBCExceptionReporter.logExceptions(sqle); throw sqle; } catch (HibernateException he) { ! session.getBatcher().closeQueryStatement(st); throw he; } --- 476,484 ---- catch (SQLException sqle) { JDBCExceptionReporter.logExceptions(sqle); + closePreparedStatement(st, selection, session); throw sqle; } catch (HibernateException he) { ! closePreparedStatement(st, selection, session); throw he; } |