This content has been marked as final.
Show 1 reply
-
1. Re: do not auto commit after method is returned
ywtsang Dec 21, 2008 9:07 AM (in response to ywtsang)persistence.xml:
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0"> <persistence-unit name="angelfish"> <jta-data-source>java:/OracleDS</jta-data-source> <properties> <property name="hibernate.ejb.cfgfile" value="hibernate.cfg.xml"/> </properties> </persistence-unit> </persistence>
hibernate.cfg.xml:<hibernate-configuration> <session-factory> <property name="connection.datasource">java:/OracleDS</property> <property name="dialect">org.hibernate.dialect.Oracle9Dialect</property> <property name="show_sql">true</property> <property name="format_sql">true</property> </session-factory> </hibernate-configuration>
class annotations of session bean@Clustered @Stateless @Interceptors(SpringLifecycleInterceptor.class) @Remote(XXX.class) @PermitAll @TransactionAttribute(TransactionAttributeType.REQUIRED) @TransactionManagement(TransactionManagementType.CONTAINER)
i have tried to add the @TransactionAttribute to the method, it also does not work
in fact, i also tried to implement SessionSynchronization
but for the all three callback methodsafterBegin afterCompletion beforeCompletion
i have added debug print outs, it seems that the SessionSynchornization methods are not called
but i am quite sure a transaction should be opened, otherwise, i will receive complain from hibernate ,
the situation now is, no exception occurs in executing the session bean method, every thing looks fine except that the updated data is not committed/flushed to db, unless we call hibernate session's flush explicitly