public void deleteRoleFunctionsbyrole( final Serializable roleid) throws Exception {
this.getHibernateTemplate().getSessionFactory()
.openSession()
.createSQLQuery("delete from role_function where role_id=?").setParameter(0, roleid);
}
this.getHibernateTemplate().getSessionFactory()
.openSession()
.createSQLQuery("delete from role_function where role_id=?").setParameter(0, roleid);
}
解决方案 »
- 程序在浏览器可以,可是在服务器跑不起来,关于js的正则
- 新手上路,foreach迭代数组问题,求大虾帮忙解答一哈
- java 简单聊天程序 客户端之间不能对话
- 使用opensessioninviewfilter管理session,运行一断时间抛出“too many connections”异常
- 一个正则表达式的问题,希望踊跃参加
- Collections.synchronizedList入门级请教
- tomcat 的问题 急啊,高手请帮忙啊。
- 怎样把STRINGBUFFER中的数据读出来 如:
- log4j的文件输出问题
- 求助!!!关于struts触发action的问题!!!!!
- 有人喜欢用struts1/2提供的html标签么???????????????????????????????????????????????????
- hibernate问题
错误信息呢?
.openSession()
.createSQLQuery("delete from role_function where role_id=? ").setParameter(0, roleid);
语句编程规范 最好分开写!有时候运行会不通过。 将sql语句字符串 最后面加一个空格
Session session=HibernateSessionFactory.getSession();
String hql="delete People where id=:id";
Transaction t=null;
try
{
t=session.beginTransaction();
Query q=session.createQuery(hql);
q.setParameter("id", id);
q.executeUpdate();
t.commit();
}catch(Exception ex)
{
if(t!=null)
{
t.rollback();
}
}finally
{
session.close();
}