hibernate儲存出錯
org.hibernate.StaleStateException: Batch update returned unexpected row count from update: 0 actual row count: 0 expected: 1
更新報錯怎麼辦
原來是有取值為空白
DBOperate dbo = new DBOperate();
news_inf inf1 = new news_inf();
inf1 = (news_inf) dbo.getObjetctById(inf1, "news_inf", request.getParameter("id"));//先這裡取值為空白了
// inf1.setId(PubFunc.parseInt(request.getParameter("id")));//這句可以不要的
inf1.setTitle(new String(request.getParameter("title").getBytes("gb2312"), "iso-8859-1"));//我有過濾器,不用考慮寫反了
inf1.setDatetime(d.toLocaleString());
inf1.setTypeid(PubFunc.parseInt(request.getParameter("typeid")));
inf1.setFrees(request.getParameter("frees"));
inf1.setNewss(request.getParameter("newss"));
inf1.setRedian(request.getParameter("redian"));
inf1.setContent(new String(request.getParameter("content").getBytes("gb2312"),"iso-8859-1"));
dbo.insert_update(inf1, "update");
這裡把我的 DBOperate.java也帖出來
package com.pp.db;
import my.HibernateUtil;
import java.sql.*;
import java.util.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.log4j.Logger;
import org.hibernate.SessionFactory;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import org.hibernate.*;
import javax.naming.*;
import com.jetsum.util.PubFunc;
import java.util.List;
import java.io.IOException;
import java.io.InputStream;
import jxl.*;
import java.io.FileInputStream;
import java.io.File;
import my.bean.member;
import java.sql.PreparedStatement;
import java.io.*;
</