April 05
Prof. Ismael H. F. Santos -  ismael@tecgraf.puc-rio.br                                                          2
Ex: Code without a template
npublic class OrderHibernateDAO implements IOrderDAO {
npublic Order saveOrder(Order order) throws OrderException{
n Session s = null;
n Transaction tx = null;
n try{
n s = ...  // get a new Session object
n tx = s.beginTransaction();
n s.save(order);
n tx.commit();
n } catch (HibernateException he){
n // log, rollback, and convert to OrderException
n } catch (SQLException sqle){
n // log, rollback, and convert to OrderException
n } finally {
n s.close();  // needs a try/catch block
n }
n return order;
n}