I have set MANUAL flush mode in components.xml.
<core:manager concurrent-request-timeout="500" conversation-timeout="120000" conversation-id-parameter="cid" parent-conversation-id-parameter="pid" default-flush-mode="MANUAL"/>
If I start a long-running conversation by calling a method annotated with @Begin, and that conversation lasts for multiple requests across multiple pages, any change made to persistent entities are flushed to the database at the end of the JSF request.
I looked at the debug.seam page, and the flush mode for the conversation is shown as MANUAL.
If I instead specify @Begin(flushMode=FlushModeType.MANUAL) on the same method, then the changes to persistent entities are held until I call entityManager.flush() near the end of the conversation.
The documentation seems to indicate that setting default-flush-mode="MANUAL" in components.xml is equivalent to adding flushMode=FlushModeType.MANUAL to all of my @Begin annotations. In my system, I think that we'll almost always want FlushModeType.MANUAL, and I would prefer just to configure this setting in components.xml.
Has anyone else seen this problem? Am I doing something wrong?
I'm testing with Seam 2.2.0. The persistence manager is set up like this:
<persistence:managed-persistence-context name="entityManager" auto-create="true" persistence-unit-jndi-name="java:/fooManagerFactory"/>
and
<persistence-unit name="foo"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>java:/fooDatasource</jta-data-source> <properties> <property name="hibernate.ejb.cfgfile" value="/META-INF/hibernate.cfg.xml"/> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/> <property name="hibernate.hbm2ddl.auto" value="create-drop"/> <property name="hibernate.show_sql" value="true"/> <property name="hibernate.format_sql" value="true"/> <property name="hibernate.default_catalog" value="FOO"/> <property name="jboss.entity.manager.factory.jndi.name" value="java:/fooEntityManagerFactory"/> </properties> </persistence-unit>