[jboss-user] [JBoss Seam] - implementing SMPC questions

asookazian do-not-reply at jboss.com
Tue Dec 18 13:28:04 EST 2007


So I'm trying to replace the EntityManager that is injected into my SFSB via @PersistenceContext with a SMPC (Seam Managed Persistence Context) as follows:

import org.jboss.seam.annotations.In;
  | import javax.persistence.EntityManager;
  | 
  | @In(create=true)
  | EntityManager em;  //a Seam-managed persistence context
1) I'm still getting "@In attribute requires non-null value: securityAuditAction.em" when I run my test case even after adding the create=true element setting in the @In attribute.  How can I fix that?

2) The previous code was as follows:

@PersistenceContext(unitName="boIcomsSecurityAudit", type=PersistenceContextType.EXTENDED)
  | private EntityManager em;

Note that I have multiple persistence units in my persistence.xml as well as multiple datasources in my *-ds.xml.  How will the SMPC know which datasource or persistence unit to use?  The optional elements for @In are required, create, scope, value.

3) The reason I'm converting to SMPC to begin with is due to the premature update that was happening in my use case (still don't know exactly where/why but think it may be flushMode=auto [default] related).  I read section 8.3.3 of the Seam and O/R mapping section of the docs and it sounds like this SMPC strategy will fix my problem (i.e. manual flush at end of conversation only).

4) is the SMPC similar to JPA EXTENDED persistence context type in that the JPA entities are not released (unmanaged) from the PC?

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

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



More information about the jboss-user mailing list