问题描述
rt!方法或是类加上@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED),会导致RunProceduresServicerunProceduresService=EJBFactory.getInterface(JNDIConstant.RUN_PROCEDURES_SERVICE_IMPL);赋值类型不匹配~小弟想针对@Stateless@Remote({RunProceduresService.class})publicclassRunProceduresServiceImplextendsBaseServiceImplimplementsRunProceduresService{@EJB(beanName="OrganizationServiceImpl")privateOrganizationServiceorganizationService;@Override@SuppressWarnings("unchecked")//@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)publicvoidrunProcedures(FormsSubmitformsSubmit,LongifNull,Long...formIds){Organizationorg=organizationService.getOrganizationById(formsSubmit.getOrgId());for(LongformId:formIds){Queryquery=em.createNativeQuery("{callCOLLECT_TEST(?,?,?,?,?,?,?)}");query.setParameter(1,formId);query.setParameter(2,formsSubmit.getPeriodId());query.setParameter(3,org.getAreaCode());query.setParameter(4,newLong(this.getOrgType(org.getType())));query.setParameter(5,formsSubmit.getOrgId());query.setParameter(6,formsSubmit.getCreateUserId());query.setParameter(7,ifNull);query.executeUpdate();}}privateintgetOrgType(LongorgType){if(orgType.compareTo(1l)==0){return3;}elseif(orgType.compareTo(2l)==0){return2;}else{return1;}}}
停用事务机制,原因是调用的存储过程需要隐式的commit,而且不可避免。现在报错:commit不允许在附属会话中……请高人援手……