-- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- - - - Jason Pyeron PD Inc. http://www.pdinc.us - - Principal Consultant 10 West 24th Street #100 - - +1 (443) 269-1555 x333 Baltimore, Maryland 21218 - - - -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- This message is copyright PD Inc, subject to license 20080407P00.
> -----Original Message----- > From: Yucca Nel [mailto:yucca...@live.co.za] > Sent: Saturday, May 01, 2010 13:38 > To: Tomcat Users List > Subject: please hwlp with hibernate strategy > > I am planning on using hibernate (1st time) in tomcat webapp. > It would appear that it is common to use hibernate util class > to load the session factory but I have yet to see this done > using Servlet ContextListener. I have also only seen very bad We load a helper class, which is the sessions factory with the webapp. >From web.xml: <listener><listener-class>us.pdinc.client.mil.navy.servlet.support.RequestScopeH ibernateSession</listener-class></listener> public class RequestScopeHibernateSession implements ServletRequestListener { public static final String PREFIX; public final String KEY; /** This method will fetch a hibernate session from request scope, stored under KEY **/ public static Session getSession(ServletRequest request); /** This method will close the session and execute the needed rollback if there is a dirty transaction **/ public void requestDestroyed(ServletRequestEvent arg0); /** This method will register this object into the request scope, under KEY. **/ public void requestInitialized(ServletRequestEvent arg0); } > example where someone used hibernate directly in their model > instead of using it as part of a DAO façade. The following While what you saw may indeed be very bad, DAO is not always an answer either. > example is half finished from netbeans > too:http://netbeans.org/kb/docs/web/hibernate-webapp.html Can > someon point met to full MVC example with hibernate. I am Its not full, but it might get the point across. http://stackoverflow.com/questions/786840/annotation-support-in-struts-2/791164# 791164 > only interested in seeing the bsckend examples really and > would any of you recommend using hibernate directly in a > model business class? > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org