用户登录
用户注册

分享至

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;

}

});

}


软件
前端设计
程序设计
Java相关