Hi all,
I would like to call stored procedures/function (from Oracle database).
Using entitymanager, I know I can map a native sql query to my entities.
The problem is, I can't map the results of my function to none of my entities, since the refcursor that is returned is too 'complicated' (mixed results from many tables, even from tables accessed via a dblink).
So, I would like to know if it is possible to create an non-managed entity (aka my simple mapping object), to which I can attach a native sql query (and results mapped with @SqlResultSetMapping).
As a hook, I'm getting the delegate hibernate session from my entitymanager :
Code:
org.hibernate.Session session = (org.hibernate.Session) entityManager.getDelegate();
quantiemes = session.getNamedQuery("MY_FUNCTION_FROM_HBM_XML")
.setParameter("p1", "US")
.setParameter("p2", "ALABAMA")
.setResultTransformer(Transformers.aliasToBean(SimplePojo.class))
.list();
Hibernate version:
Hibernate EntityManager 3.3.1.GA
Name and version of the database you are using:
Oracle 8.1.7.4 - 10g
Thanks for helping !