This content has been marked as final.
Show 3 replies
-
1. Re: can not do persist transaction
gonorrhea Apr 24, 2009 1:07 AM (in response to quintenjiang.kinsonjob.yahoo.com)Looks like that is a JavaBean component and not an EJB (SFSB/SLSB). I'm not sure exactly of the Seam tx semantics for JavaBean components. Show your entire components.xml code.
With EJB3/CMT, a transaction is required by default for all business methods (public methods in local/remote interface for you EJB3 class). The container begins a tx (if required it can join an existing tx), and commits the tx at the end of the method.
It gets trickier if you're using Hibernate's MANUAL flushMode vs. EJB3 AUTO (default) or COMMIT.
-
2. Re: can not do persist transaction
quintenjiang.kinsonjob.yahoo.com Apr 24, 2009 4:51 AM (in response to quintenjiang.kinsonjob.yahoo.com)my component.xml like ( working under Jboss):
<core:init debug="true" jndi-pattern="@jndiPattern@"/>
<core:manager concurrent-request-timeout="500"
conversation-timeout="120000"
conversation-id-parameter="conversationId"
parent-conversation-id-parameter="pid"/>
<transaction:entity-transaction entity-manager="#{entityManager}"/>
<persistence:entity-manager-factory name="consoleflexEntityManagerFactory"
persistence-unit-name="consoleflex"/>
<persistence:managed-persistence-context name="entityManager"
auto-create="true"
entity-manager-factory="#{consoleflexEntityManagerFactory}" persistence-unit-jndi-name="java:/consoleflexEntityManagerFactory" />
and persistence.xml:
<persistence-unit name="consoleflex" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/consoleflexDatasource</jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
<property name="jboss.entity.manager.factory.jndi.name" value="java:/consoleflexEntityManagerFactory"/>
</properties>
</persistence-unit> -
3. Re: can not do persist transaction
gonorrhea Apr 24, 2009 8:22 PM (in response to quintenjiang.kinsonjob.yahoo.com)RESOURCE_LOCAL is typically used for Java SE apps. If you're in a EE envmt (using JBoss AS, for example), you should use JTA instead of RESOURCE_LOCAL.
Transaction type used. Either JTA or RESOURCE_LOCAL (default to JTA in a JavaEE environment and to RESOURCE_LOCAL in a JavaSE environment). When a jta-datasource is used, the default is JTA, if non-jta-datasource is used, RESOURCE_LOCAL is used.So is your Seam app SE or EE??