Announcement Announcement Module
No announcement yet.
Transaction mode changed from FlushMode.COMMIT/AUTO to FlushMode.NEVER/MANUAL on Ex Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Transaction mode changed from FlushMode.COMMIT/AUTO to FlushMode.NEVER/MANUAL on Ex

    We are using Spring declarative Trsnaction with Hibernate Transaction Manager in service layer.

    <filter-class> penSessionInViewFilter</filter-class>

    <bean id="integrationServiceTransactionInterceptor" class="org.springframework.transaction.interceptor .TransactionInterceptor">
    <property name="transactionManager">
    <ref bean="transactionManager"/>
    <property name="transactionAttributeSource">
    PermissionService.*=PROPAGATION_REQUIRED,timeout_$ {transaction.timeout.update}
    PermissionService.find*=PROPAGATION_REQUIRED,readO nly,timeout_${transaction.timeout.readonly}

    <bean id="restartTransactionInterceptor" class="com.novacitynets.pavo.common.util.RestartTr ansactionAdviser">

    Also we are using RestartTransactionAdviser intercertor to restart the transaction if deadLock or lock Exception occured.

    public Object invoke(MethodInvocation invocation) throws Throwable {
    return restart(invocation, 1);

    private Object restart(MethodInvocation invocation, int attempt)
    throws Throwable {
    Object rval = null;
    try {
    rval = invocation.proceed();
    } catch (Exception e) {
    return restart(invocation, attempt);

    return rval;

    But while restarting the transaction the mode changed from FlushMode.COMMIT/AUTO to FlushMode.NEVER/MANUAL
    so it is giving Exception org.springframework.dao.InvalidDataAccessApiUsageE xception: Write operations are not allowed in read-only mode (FlushMode.NEVER/MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition on completing the transaction.