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]

Reply via email to