我无法使用会话工厂从 java hibernate 调用我的存储过程
我编写了一个 sql 过程,它接受 5 个参数并返回一个在 MS SQL 工作室中运行良好的结果集
EXEC SlaGrid @appID=245,@fromYear=2012,@toYear=2013,@fromMon=1,@toMon=12 --- sql
EXEC SlaGrid @applID=:applID,@fromYear=:fromYear,@toYear=:toYear,@fromMon=:fromMon,@toMon=:toMon --hibernate
我正在为上述查询设置参数
String queryString = "EXEC SlaGrid @applID=:applID,@fromYear=:fromYear,@toYear=:toYear,@fromMon=:fromMon,@toMon=:toMon"
Query query = sessionFactory.getCurrentSession().createSQLQuery(queryString);
//set query parameters here
query.list() --- giving sql grammer exception