jdbctemplate无法检索数据

时间:2014-06-02 12:58:20

标签: mysql spring jdbctemplate spring-transactions

我有方法execute()调用saveCom()这是requires_new方法并提交数据,然后通过调用saveCom以下检索相同的方法我无法检索数据

 @Async
    @Transactional   
     public void execute(){

       commService.saveCom(comm);//this is a Requires_New method.Data gets ccommmited here
       List<Comm> commList = commDao.getComm(comm);
    }

//get is used then to retrieve the data
  public List<Comm> getCom(Comm comm) throws PimsAppException {
        List<Comm> restriction_list = new ArrayList<Comm>();
        try {   

                    Object[] updateObjs = new Object[]{comm.getCommId(),comm.getCountryofDestination(),
                            comm.getPortOfEntry()};
                    restriction_list = jdbcTemplate.query(""    SELECT *        FROM   pims.pdcommrestriction   WHERE  ( commodityid = ?  AND countryofdestination = ?   AND portofentry = ? ),updateObjs,new CommMapper());


        }

        catch (Throwable e) {
            Logger.getLogger().error("Class=CommImpl; Method=getComm "+e);

        }
    return restriction_list;
    }

执行saveCom方法后,我可以看到数据已插入数据库但是当我尝试通过调用getComm()来检索下一行中的数据时。它无法检索数据....

使用Requires_NEW提交数据后,jdbctemplate无法检索数据有什么问题吗?

更新: 如果我在执行时删除@Transactional,getCom就能够检索数据

0 个答案:

没有答案
相关问题