日期:2014-05-19  浏览次数:20719 次

求帮忙解决 。 Hibernagte 错误
先代码:
Action:

public String updateSubmit() throws Exception{
String n = "1";
try{
entityService.update(filterProductId,n);
return RELOAD;
}catch (Exception e) {
e.printStackTrace();
return ERROR;
}
}

Service:

public void update(String pId,String n){
entityDao.update(pId,n);

}

Dao:

public void update(String pId,String n){
try{
String hql ="update Product p set resv1 = '"+ n +"' where p.productId = ?";
getHibernateTemplate().bulkUpdate(hql, pId);
getHibernateTemplate().flush();
}catch (Exception e) {
e.printStackTrace();
}
}

Jsp页面:

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <title>产品明细</title>
  <script type="text/javascript">
   
  function back(){
history.go(-1);
}

function findByIdFrom(form,id,typeId){
document.getElementById('filterProductId').value=id;
document.getElementById('filterProductTypeId').value=typeId;
var url='<s:url action="updateSubmit" namespace="/product"/>';
form.action = url;
form.submit();
}

function findByIdresv(form,id,resv,a){
document.getElementById('filterProductId').value=id;
document.getElementById('filterResv').value=resv;
document.getElementById('a').value=a

var proId = "";
var proIds = "";
var proName = "";
var productIdObj = document.getElementsByName('productId');
var proNameObj = document.getElementsByName('proName');
for(var i = 0; i < productIdObj.length; i++){
proIds = productIdObj[i].value + ",";
proName = proNameObj[i].value; + ",";
proId += proIds + proName + ";";
}
var url='<s:url action="toAdd" namespace="/sellorder"/>';
document.getElementById('proId').value = proId;
form.action = url;
form.submit();
}










function showfileter(){
var field = document.getElementById("fieldDiv").style.display;
if(field == "none"){
document.getElementById("fieldDiv").style.display="block";
}else{
document.getElementById("fieldDiv").style.display="none";
}
}


</script>

  </head>
  
  <body>
  <!--<button onclick="back();">返回</button>
  --><s:form action="updateSubmit" namespace="/quote" method="post">
  <s:hidden name="filterProductId" id="filterProductId" value=""/>
  <s:hidden name="filterProductTypeId" id="filterProductTypeId" value=""/>
  <s:hidden name="filterResv" id="filterResv" value=""/>
  <s:hidden id="a" name="a" value=""/>
  <s:hidden id="proId" name="proId" value=""/>
  <s:token/>
 
&nb