-
1. Re: Can I use Seam conversation scope PC in Jetty?
asookazian Mar 9, 2010 12:23 AM (in response to philip142au.philip_andrew.hotmail.com)AFAIK, the SMPC, conversation scope, and Hibernate manual flush are all independent of the RDBMS and app server you're using. That being said, I've only worked on Seam projects with SQL server and Oracle RDBMS's.
Also, I've used the following exclusively for SMPC injection:
@In EntityManager entityManager;
and this for Hibernate Manual flush:
@Begin(join=true, flushMode=FlushModeType.MANUAL)
to flush the PC changes to the DB:
entityManager.flush();
But in your case you're using Hibernate Session injection. So this is from the ref doc:
To configure Hibernate managed transactions declare the following in your components.xml where #{hibernateSession} is the name of the project's persistence:managed-hibernate-session component. If your managed hibernate session is named session, you can opt to leave out the session attribute. (see Seam-managed persistence contexts ) <transaction:hibernate-transaction session="#{hibernateSession}"/>
more from ref doc:
In either case, you'll need to use a managed persistence context (for JPA) or a managed session (for Hibernate) in your components. A Seam-managed persistence context is just a built-in Seam component that manages an instance of EntityManager or Session in the conversation context. You can inject it with @In.
AFAIK, you do not need to use the merge() operation, if you are using the default AUTO flushMode, when the transaction commits at the end of the method marked @Transactional, the changes in the PC should be persisted to the DB.
see 9.3.2. Using a Seam-managed Hibernate session in the ref doc:
Note that Seam does not flush the session, so you should always enable hibernate.transaction.flush_before_completion to ensure that the session is automatically flushed before the JTA transaction commits.