I agree with using Spring. Also, using the jpaTemplate has little value as indicated in the Spring docs. Instead, use the @Repository annotation in your implementation class.
> Date: Mon, 12 Nov 2007 09:11:04 -0600 > From: [EMAIL PROTECTED] > To: dev@struts.apache.org > Subject: Re: JPA in mailreader > > My vote is to just use spring, for both EntityManagerFactory injection > and Transaction Management. As Richard and I were discussing this > weekend, Spring is a very common framework when used with Struts. It > will also provide a full stack Struts/Spring/JPA example. > Tom > > On Nov 12, 2007 9:05 AM, Wes Wannemacher wrote: >> Hello, >> >> I've been quietly learning JPA / implementing a JPA struts2-mailreader. >> >> I have a judgment call to make now and wanted some input. At first I >> was hoping to create this in a non-IoC fashion. This was simply to >> keep the dependencies at a minimum and concentrate on integrating JPA >> and struts2. But, in many spots, the JPA docs indicate that the >> EntityManagerFactory should be injected (although it isn't that hard >> to instantiate by hand). I've thought about using Spring, which will >> make things pretty easy with it's transaction management and DI. It >> has been suggested to me to use the JpaTemplate, but while I was >> reading the JavaDoc for it - >> >> http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/orm/jpa/JpaTemplate.html >> >> It indicates that new projects should use a DAO with a shared EM injected. >> >> If I make DAOs, I may skip Spring altogether. >> >> Also, I could do the transaction management in the DAO implementations >> or try to hook into the transactional management of an ee server. If I >> manage the transactions myself, it will make mailreader work in non-ee >> servers as well. However, if this is a "best-practices" example, I >> should probably use the ee server. What do you guys think will be the >> best approach. >> >> -Wes >> >> -- >> Wesley Wannemacher >> President, Head Engineer/Consultant >> WanTii, Inc. >> http://www.wantii.com >> >> --------------------------------------------------------------------- >> 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] > _________________________________________________________________ Express yourself with free Messenger emoticons. Get them today! http://www.freemessengeremoticons.ca/?icid=EMENCA122 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]