更多详情可以参考 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();