List of usage examples for org.springframework.dao CleanupFailureDataAccessException CleanupFailureDataAccessException
public CleanupFailureDataAccessException(String msg, Throwable cause)
From source file:org.sakaiproject.scorm.ui.player.HibernateFilter.java
@Override protected void closeSession(Session session, SessionFactory sessionFactory) { try {//from w ww . jav a 2s. co m if (session != null && session.isOpen() && session.isConnected()) { try { session.flush(); } catch (HibernateException e) { throw new CleanupFailureDataAccessException( "Failed to flush session before close: " + e.getMessage(), e); } catch (Exception e) { } } } finally { super.closeSession(session, sessionFactory); } }
From source file:com.oracle2hsqldb.spring.MetaDataJdbcTemplate.java
public void query(RowCallbackHandler rowHandler) { Connection connection = getConnection(); ResultSet results = null;// w w w. j a va 2 s . c om try { results = getResults(connection.getMetaData()); while (results.next()) { rowHandler.processRow(results); } } catch (SQLException e) { throw new MetaDataAccessException(e); } finally { try { if (results != null) results.close(); } catch (SQLException e) { log.warn("could not close the ResultSet", e); } try { if (connection != null) connection.close(); } catch (SQLException e) { throw new CleanupFailureDataAccessException("could not close Connection", e); } } }
From source file:at.ac.univie.isc.asio.engine.sql.JdbcExecution.java
public void cancel() { try {/*from w ww .j ava2 s . c o m*/ if (statement != null) { statement.cancel(); } } catch (SQLException e) { throw new CleanupFailureDataAccessException("error when cancelling jdbc execution", e); } finally { close(); } }
From source file:org.gageot.excel.core.ExcelTemplate.java
private <T> T read(Function<HSSFWorkbook, T> transform) { checkNotNull(getResource(), "resource must not be null"); InputStream in = null;/*from www. ja va 2 s. co m*/ try { in = new BufferedInputStream(getResource().getInputStream()); return transform.apply(new HSSFWorkbook(in, false)); } catch (IOException e) { throw new DataAccessResourceFailureException("Problem reading file", e); } finally { if (null != in) { try { in.close(); } catch (IOException e) { throw new CleanupFailureDataAccessException("Problem closing file", e); } } } }