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(); }; } }
-------------------------------------------------------
This SF.net email is sponsored by: Microsoft Visual Studio.NET comprehensive development tool, built to increase your productivity. Try a free online hosted session at:
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel