我可以使用休眠条件调用存储过程吗? [英] Can I call a stored procedure with hibernate criteria?
本文介绍了我可以使用休眠条件调用存储过程吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的问题,我必须使用一个大的SP,并且没有时间用java重写。
所以我使用Hibernate标准,我不知道我是否可以调用它。感谢大家。
映射的/reference/en/html/querysql.html#sp_queryrel =nofollow noreferrer> (b)
$ b
List employment = sess.getNamedQuery
映射查询可以返回实体。
< sql-query name =BigSPcallable =true>
< return alias =empclass =Employment>
< return-property name =employeecolumn =EMPLOYEE/>
< return-property name =employercolumn =EMPLOYER/>
< return-property name =startDatecolumn =STARTDATE/>
< return-property name =endDatecolumn =ENDDATE/>
< return-property name =regionCodecolumn =REGIONCODE/>
< return-property name =idcolumn =EID/>
< return-property name =salary>
< return-column name =VALUE/>
< return-column name =CURRENCY/>
< / return-property>
< / return>
{call BigSP}
< / sql-query>
This is my problem, I have to use a big SP, and there is no time to rewrite in java. So I'm using Hibernate criteria and I don't know if i can call it. Thanks to all.
解决方案
See Using stored procedures for querying in the reference documentation.
Mapped queries are called like this.
List employment = sess.getNamedQuery("BigSP")
.list();
A mapped query can return entities.
<sql-query name="BigSP" callable="true">
<return alias="emp" class="Employment">
<return-property name="employee" column="EMPLOYEE"/>
<return-property name="employer" column="EMPLOYER"/>
<return-property name="startDate" column="STARTDATE"/>
<return-property name="endDate" column="ENDDATE"/>
<return-property name="regionCode" column="REGIONCODE"/>
<return-property name="id" column="EID"/>
<return-property name="salary">
<return-column name="VALUE"/>
<return-column name="CURRENCY"/>
</return-property>
</return>
{ call BigSP }
</sql-query>
这篇关于我可以使用休眠条件调用存储过程吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文