How can I call Oracle stored procedure which has one out parameter as sysrefcursor using Hibernate?

笑着哭i 提交于 2019-12-06 22:14:35

You can do the following in order to call a procedure which return sys_refcursor (annotation)

@javax.persistence.NamedNativeQuery(name = "getProc", query = "{ call
CITYMST_LIST(?,:cmpid,:status) }", resultClass = <EntityClass>.class, hints = {
@javax.persistence.QueryHint(name = "org.hibernate.callable", value = "true") })

In DAOImpl

Query query = entityManager.createNamedQuery("getProc"); 
query.setParameter("cmpid","123"); 
query.setParameter("status","true"); 
query.getResultList(); 
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!