-
1. Re: Seam Spring Hibernate Integration
asookazian Jul 24, 2009 6:51 PM (in response to gevaudan)There is a free, online chapter on Seam and Spring integration here: www.manning.com/dallen from SiA book.
The best way to avoid LIEs is to use an extended container managed-PC (scoped to component life) or SMPC (scoped to conversation life). Typically in Seam apps, we use SMPC exclusively. The general goal with an extended-PC is to keep the EntityManager open after a business method call. With a tx-scoped PC, the EntityManager is closed after a business method call (and thus sets up the LIE
trap
).The goal with SMPC is to keep the EntityManager open until the conversation ends, and you can also use Hibernate manual flush with SMPC, which has advantages as well. In fact, the SMPC and manual flush combo is the general recommendation in Seam to achieve atomic conversations.
The other alternative is eager fetching which has disadvantages as well like loading too many entities into the PC.
As far as how and what to integrate Spring with Seam apps, refer to the above link. If you have existing Spring beans that you'd like to re-use, then it makes sense to integrate. Otherwise, you can write your own Seam and/or EJB managed DAO layer.