[jboss-user] [JBoss Seam] - Re: core:managed-persistence-context question

CptnKirk do-not-reply at jboss.com
Fri Apr 13 17:33:07 EDT 2007


The is the typical @In vs @PersistenceContext question.  The answer is summed up nicely in this thread.

http://jboss.com/index.html?module=bb&op=viewtopic&t=106019

Basically to answer your questions:

1.  What the <core:...> is doing for you is configuring a Seam managed persistence context.  You take advantage of this by using the Seam managed context instead of the EJB3 managed context.

2.  How do I do that?  Use the @In annotation.  The Seam managed context is a Seam component exposed via Seam's bijection mechanism so use the @In annotation to get it.

3.  So how are they different?  See Christian's answer in the link above, or read my answer here.  First, the following link has a good description of Seam and ORM.  http://docs.jboss.com/seam/1.2.1.GA/reference/en/html/persistence.html Use the link to familiarize yourself with the benefits of the EJB3 extended PersistenceContext.  The difference between the Seam PC and the EJB3 PC is that Seam provides a couple of features that EJB3 doesn't, otherwise in terms of APIs they're the same.

1.  The lifecycle of the EJB3 PC is bound to a Stateful Session Bean, and is only shared between components participating in the same transaction.  The Seam PC has conversation scope and can be injected into any component participating in that conversation regardless of its transaction context.

2.  Seam PC has better clustering and caching abilities.  See the Seam doc link above for reasons why.

3.  Seam PC is managed by Seam not EJB3, thus it can be used within non EJB3 Seam components.  So you can still benefit from a standard JPA interface while allowing Seam to manage the PC and transactions for you, all outside of EJB3.  

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4037241#4037241

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4037241



More information about the jboss-user mailing list