Announcement Announcement Module
Collapse
No announcement yet.
Transactions not working,Transactions commiting order? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Transactions not working,Transactions commiting order?

    I have two service Manager,using oracle 10g,hibernate.dialect is org.hibernate.dialect.OracleDialect.

    one service is PmTmartpfManagerImpl.java:
    Code:
    	public void savePmTmartpf(PmTmartpf pmTmartpf) {
    		dao.savePmTmartpf(pmTmartpf);
    		
    	}
    	public void savePmTmartpf(PmTmartpf pmTmartpf,ProcessServiceSession pss,String beWFName) {
                try{
                    log.debug("11111111111");
                    try {
    //                    dao.savePmTmartpf(pmTmartpf);
                        savePmTmartpf(pmTmartpf);//is failed
                    } catch (Exception e) {
                        log.debug("2222222222", e);
                        throw new RuntimeException();
                    }
                    HashMap commonData = new HashMap();
    
                    commonData.put("processDefId", beWFName);
                    //System.out.print("@@@@"+pmTmartpf.getPlanCode());
                    workFlowService.newProcessIns(pss, commonData);//but it is successful
                }catch(Exception ex){
                    log.debug("444444444",ex);
                    throw new RuntimeException();
                }catch(Error ex){
                    log.debug("555555555",ex);
                    throw new RuntimeException();                
                }
    	}
    another service is WorkFlowService:
    Code:
    	public InstanceInfo newProcessIns(ProcessServiceSession pss,
    			HashMap commonData) {
    
                                            SysWorkitem workItem=new SysWorkitem();
                                            workItem.setActivityName(ins.getActivity().getLabel(Locale.SIMPLIFIED_CHINESE));
                                            workItem.setBusiType(ins.getProcess().getDescription(Locale.SIMPLIFIED_CHINESE));
                                            workItem.setStartTime(sdf.format(new Date()));
                                            workItem.setInstanceIn(ins.getId());
                                            workItem.setParticipant((String)commonData.get("arg_userName"));
                                            workItem.setPreActivity(null);
                                            workItem.setEndTime(null);
                                            workItem.setState(new Long(0));
                                            workItem.setWorkSheetNo((String)commonData.get("arg_uniqueNo"));
    
                                            this.saveWorkItem(workItem);
    
    				}
    			} else {
    
    				log
    						.error("newProcessIns: that ProcessServiceSession is null or not Opened");
    			}
    
    		} catch (Exception e) {
    
    			log.error(e.getMessage(), e);
    			throw new AppException(":" + e.getMessage(), e);
    		}
    		return ins;
    	}
    this is txProxyTemplate config:
    Code:
        <bean id="txProxyTemplate" abstract="true"
            class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
            <property name="transactionManager" ref="transactionManager"/>
            <property name="transactionAttributes">
                <props>
                    <prop key="save*">PROPAGATION_REQUIRED,-java.lang.Exception</prop>
                     <prop key="getId*">PROPAGATION_REQUIRES_NEW</prop>
                     <prop key="getMultiId*">PROPAGATION_REQUIRES_NEW</prop>
                     <prop key="getIdStr*">PROPAGATION_REQUIRES_NEW</prop>
                     <prop key="getMultiIdStr*">PROPAGATION_REQUIRES_NEW</prop>                  
                    <prop key="remove*">PROPAGATION_REQUIRED,-java.lang.Exception</prop>
                    <prop key="newProcessIns*">PROPAGATION_REQUIRED,-java.lang.Exception</prop>
                    <prop key="runProcessIns*">PROPAGATION_REQUIRED,-java.lang.Exception</prop>
                    <prop key="startProcess*">PROPAGATION_REQUIRED,-java.lang.Exception</prop>
    
                </props>
            </property>
        </bean>
    what's wrong? thank you!

  • #2
    &quot;Getting transaction &quot; and &quot;Invoking commit &quot; order is not same!

    my runtime log is :
    2006-10-14 14:40:53,750 - DEBUG http-80-Processor9 [TransactionAspectSupport] - Getting transaction for com.sunrise.psmis.pm.service.PmTmartpfManager.savePmTmartpf
    2006-10-14 14:40:53,843 - DEBUG http-80-Processor9 [TransactionAspectSupport] - Getting transaction for com.sunrise.psmis.sysmanagement.service.WorkFlowService.newProcessIns

    2006-10-14 14:40:54,328 - DEBUG http-80-Processor9 [TransactionAspectSupport] - Invoking commit for transaction on com.sunrise.psmis.sysmanagement.service.WorkFlowService.newProcessIns
    2006-10-14 14:40:54,328 - DEBUG http-80-Processor9 [TransactionAspectSupport] - Invoking commit for transaction on com.sunrise.psmis.pm.service.PmTmartpfManager.savePmTmartpf


    "Getting transaction " and "Invoking commit " order is not same!

    Comment


    • #3
      It shouldn't be be the same.

      Your first transaction starts here:
      public void savePmTmartpf(PmTmartpf pmTmartpf,ProcessServiceSession pss,String beWFName) {

      and not here:
      savePmTmartpf(pmTmartpf);//is failed

      Comment

      Working...
      X