org.hibernate.exception.GenericJDBCException: could not execute query 5
rootcausejava.sql.SQLException:CannotissuedatamanipulationstatementswithexecuteQuery(...
root cause
java.sql.SQLException: Can not issue data manipulation statements with executeQuery().
代码: public List updateset(String kch){
Session session=getHibernateTemplate().getSessionFactory().openSession();
Query query=session.createSQLQuery("update Kcb set flag='已选' where kch="+kch+" order by kch");
query.executeUpdate();
List list=query.list();
session.close();
session=null;
return list;
}
public List updateset2(String kch){
Session session=getHibernateTemplate().getSessionFactory().openSession();
Query query=session.createSQLQuery("update Kcb set flag='未选' where kch="+kch+" order by kch");
query.executeUpdate();
List list=query.list();
session.close();
session=null;
return list;
}
更新是成功的,但是会跳出那个异常。。求解 展开
java.sql.SQLException: Can not issue data manipulation statements with executeQuery().
代码: public List updateset(String kch){
Session session=getHibernateTemplate().getSessionFactory().openSession();
Query query=session.createSQLQuery("update Kcb set flag='已选' where kch="+kch+" order by kch");
query.executeUpdate();
List list=query.list();
session.close();
session=null;
return list;
}
public List updateset2(String kch){
Session session=getHibernateTemplate().getSessionFactory().openSession();
Query query=session.createSQLQuery("update Kcb set flag='未选' where kch="+kch+" order by kch");
query.executeUpdate();
List list=query.list();
session.close();
session=null;
return list;
}
更新是成功的,但是会跳出那个异常。。求解 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询