Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 87471 invoked from network); 1 May 2010 18:47:25 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 1 May 2010 18:47:25 -0000 Received: (qmail 11914 invoked by uid 500); 1 May 2010 18:47:21 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 11760 invoked by uid 500); 1 May 2010 18:47:21 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 11751 invoked by uid 99); 1 May 2010 18:47:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 01 May 2010 18:47:21 +0000 X-ASF-Spam-Status: No, hits=-1.3 required=10.0 tests=AWL,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [67.90.184.26] (HELO mail.pdinc.us) (67.90.184.26) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 01 May 2010 18:47:15 +0000 Received: from phoenix (c-68-49-204-238.hsd1.md.comcast.net [68.49.204.238]) (authenticated bits=0) by mail.pdinc.us (8.12.11.20060308/8.12.11) with ESMTP id o41IkwFr012400 for ; Sat, 1 May 2010 14:46:59 -0400 From: "Jason Pyeron" To: "'Tomcat Users List'" References: Subject: RE: please hwlp with hibernate strategy Date: Sat, 1 May 2010 14:51:44 -0400 Organization: PD Inc Message-ID: <7E059F99793C4E028EF466776E4D2E03@phoenix> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 In-Reply-To: Thread-Index: AcrpVTHFmUC3vxmRRSiOWfYx+l5VtwACMREQ -- -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- - - - Jason Pyeron PD Inc. http://www.pdinc.us - - Principal Consultant 10 West 24th Street #100 - - +1 (443) 269-1555 x333 Baltimore, Maryland 21218 - - - -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-= =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- This message is copyright PD Inc, subject to license 20080407P00. =20 > -----Original Message----- > From: Yucca Nel [mailto:yuccanel@live.co.za]=20 > Sent: Saturday, May 01, 2010 13:38 > To: Tomcat Users List > Subject: please hwlp with hibernate strategy >=20 > I am planning on using hibernate (1st time) in tomcat webapp.=20 > It would appear that it is common to use hibernate util class=20 > to load the session factory but I have yet to see this done=20 > using Servlet ContextListener. I have also only seen very bad=20 We load a helper class, which is the sessions factory with the webapp. >From web.xml: us.pdinc.client.mil.navy.servlet.support.Reques= tScopeH ibernateSession public class RequestScopeHibernateSession implements = ServletRequestListener=20 { 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=20 > instead of using it as part of a DAO fa=E7ade. The following=20 While what you saw may indeed be very bad, DAO is not always an answer = either. > example is half finished from netbeans=20 > too:http://netbeans.org/kb/docs/web/hibernate-webapp.html Can=20 > someon point met to full MVC example with hibernate. I am=20 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=20 > would any of you recommend using hibernate directly in a=20 > model business class? >=20 --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org