JPA entitymanager 如何获取Oracle 返回的cursor结果
时间:2014-05-18 02:47:14
收藏:0
阅读:564
更多详情可以参考 http://www.objectdb.com/api/java/jpa/annotations/sql
以下是参照网友的例子
- create or replace procedure
- findPerson(my_cursor out sys_refcursor, param in string)
- as
- begin
- open my_cursor for
- select p.* from persons p where u.name like param;
- end findPerson;
- @NamedNativeQuery(name = "personQuery",
- resultClass = Person.class,
- query = "{call findPerson(?, :personName)}",
- hints = {
- @QueryHint(name = "org.hibernate.callable", value = "true")
- }
- )
- Query query = em.createNamedQuery("personQuery");
- query.setParameter("personName","john");
- List folks = query.getResultList();
评论(0)