hibernate执行sql文件
- 作者: 回忆14638387
- 来源: 51数据库
- 2020-10-14
怎么在hibernate 中执行一个update的sql语句
/**
* 执行非查询sql
* @param sql
*/
public void executesql(string sql){
final string tempsql = sql;
this.gethibernatetemplate().execute(new hibernatecallback()
{
public object doinhibernate(session session)
throws hibernateexception
{
session.createsqlquery(tempsql).executeupdate();
return null;
}
});
}
推荐阅读
