From: Dave J. <sno...@nc...> - 2002-12-04 05:10:02
|
In the Hibernate implementation of the DAO, I implement the removeNewsfeed method shown below. Why is the call to ses.load() necessary? - Dave public void removeNewsfeed( Newsfeed feed ) throws DAOException { removeObject( ag.Newsfeed.class, feed.getId(), feed ); } private void removeObject( Class clazz, String id, Object obj ) throws DAOException { Session ses = null; try { ses = sessionFactory.openSession(); obj = ses.load(clazz,id); ses.delete(obj); ses.flush(); ses.connection().commit(); } catch (Exception e) { try { ses.connection().rollback(); } catch (Exception ex) { e.printStackTrace(); }; throw new DAOException(e); } finally { try { ses.close(); } catch (Exception ex) { ex.printStackTrace(); }; } } |