public <T> T update(UpdateQuery<T> query) throws DBException { try { query.setDb(this); Session session = this.beginTransaction(); T result = query.query(session); this.commit(); return result; } catch (DBException e) { this.rollback(); throw e; } catch (Exception e) { this.rollback(); throw new DBException("Update Error: ", e); } finally { this.endTransaction(); } }