你都用到spring了还问这个问题...hibernate有自己的saveorupdata().

解决方案 »

  1.   

    spring管理hibernate,模板里不是有save()方法吗?
      

  2.   

    ApplicationContext ctx=new ClassPathXmlApplicationContext("applicationContext.xml");
    XXXDAO XXXDao=XXXDAO.getFromApplicationContext(ctx);
    XXX XXX=new XXX();
    List XXXList=XXXDao.findByExample(XXX);
    request.setAttribute("XXXList",XXXList);
    return mapping.findForward("index");这个是查找的,插入的改一下就行了!!