Hi, Please check the complete example at http://www.roseindia.net/struts/hibernate-spring/
Thanks -----Original Message----- From: Håkan Jacobsson [mailto:[EMAIL PROTECTED] Sent: Thursday, August 28, 2008 1:25 AM To: user@struts.apache.org Subject: Ang: RE: Struts2 with JPA/Hibernate using Spring Martin, Big thanx for a quick answer! If I understand you correctly - both persistence.xml and applicationContext. xml can be placed together with the JPA/Hibernate classes in a jarfile located in WEB-INF/lib in the web app? /regards, Håkan >----Ursprungligt meddelande---- >Från: [EMAIL PROTECTED] >Datum: 2008/08/27 21:34 >Till: "Struts Users Mailing List"<user@struts.apache.org> >Ärende: RE: Struts2 with JPA/Hibernate using Spring > > >the JPA package structure would look like: >WEB-INF/classes/package/persistence/*.class >WEB-INF/classes/META-INF/persistence.xml >WEB-INF/classes/META-INF/orm.xml (optional) > >OR you could jar everything into one jar and place in lib folder >WEB-INF/lib/*.jar > >documentation located at >http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd > >example hibernate data-source configured would be petclinic sample ./META- INF/application-context.xml ><beans> > <bean id="dataSource" class="org.springframework.jdbc.datasource. DriverManagerDataSource"> > <property name="driverClassName"><value>org.hsqldb. jdbcDriver</value></property> > <property name="url"><value>jdbc:hsqldb:hsql://localhost: 9001</value></property> > <property name="username"><value>root</value></property> > <property name="password"><value>root</value></property> > </bean> > >and of course the Spring servlets from web.xml > <servlet> > <servlet-name>context</servlet-name> > <servlet-class>org.springframework.web.context. ContextLoaderServlet</servlet-class> > <load-on-startup>1</load-on-startup> > </servlet> > > <servlet> > <servlet-name>petclinic</servlet-name> > <servlet-class>org.springframework.web.servlet. DispatcherServlet</servlet-class> > <load-on-startup>2</load-on-startup> > </servlet> > >suggest starting with spring petclinic as your model.. >http://www.java2s.com/Code/Java/Spring/SpringJPetStoresampleapplication.htm > >another good example if using struts with sprint is the JPetStore app >http://www.java2s.com/Code/Java/Spring/SpringJPetStoresampleapplication.htm > >anyone else? >Martin >______________________________________________ >Disclaimer and confidentiality note >Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. > > >> Date: Wed, 27 Aug 2008 20:29:59 +0200 >> From: [EMAIL PROTECTED] >> To: user@struts.apache.org >> Subject: Struts2 with JPA/Hibernate using Spring >> >> Hi, >> >> I have a Struts2 web application. I'm using Spring (for autowiring of >> dependency injection) to integrate JPA and Hibernate in the web app. >> It's working fine. >> Now I need to separate the JPA/Hibernate classes into a >> separate jar file (the web app will have this jar file as a dependency). >> How should I configure this? So far, I have my applicationContext.xml and >> persistence.xml files in the web app. Should those files now be put in the >> separate jarfile? Do I need to make other configuration changes to the web app? >> >> I'm a newbie to both Spring and web app configuration. Any help much >> appreciated! >> >> /best regards, Hakan Jacobsson - System developer in Sweden >> >> >> /MVH, Håkan Jacobsson >> >> ######################## >> >> Torsvikssvängen 52, 1/2 tr. >> 181 34 Lidingö >> tel: 08-765 84 37 >> mob: 076-272 53 85 >> >> ######################## >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> > >_________________________________________________________________ >Get thousands of games on your PC, your mobile phone, and the web with Windows®. >http://clk.atdmt.com/MRT/go/108588800/direct/01/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]