Hi, i'm trying to make Hibernate get some results of a Function but have this Exception:
%%%% Error Creating SessionFactory %%%%
org.hibernate.HibernateException: Errors in named queries: PAADMINISTRACION.FNCONSPAISES
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:407)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341)
at Com.Elektra.MiSocio.Hibernate.HibernateSessionFactory.<clinit>(HibernateSessionFactory.java:31)
at Com.Elektra.MiSocio.Test.Test2Query.main(Test2Query.java:23)package Com.Elektra.MiSocio.Shared.Hibernate.Entities.Dto;
Code:
public class PaisesDTO {
Integer FIPAISID;
String FCDESCRIPCION;
getters & setters...
}
Code:
<sql-query name="PAADMINISTRACION.FNCONSPAISES" callable="true">
<return alias="paises" class="Com.Elektra.MiSocio.Shared.Hibernate.Entities.Dto.PaisesDTO">
<return-property name="fipaisid" column="FIPAISID"/>
<return-property name="fcdescripcion" column="FCDESCRIPCION"/>
</return>
{ ? = call PAADMINISTRACION.FNCONSPAISES() }
</sql-query>
Code:
Transaction tx = null;
Session s = HibernateSessionFactory.getSession();
The exception occurs when creating the Session. But I have found this:
If I remove the return tag from my mapping:
Code:
<sql-query name="PAADMINISTRACION.FNCONSPAISES" callable="true">
{call PAADMINISTRACION.FNCONSPAISES()}
</sql-query>
Theres no such exception and also I can see the resulting list size ( 8 which are the values at the moment )
And if I replace the return tag for
Code:
<return-scalar column="FCDESCRIPCION"/>
I´m able to get a List containing the description of the FCDESCRIPCION column,
It´s just not working when trying to use my PaisDTO as the transfer object.
What I´m I missing here?
This is my Function which is inside the package declared in my sql-query tag
Code:
FUNCTION FNCONSPAISES
RETURN typCursor
AS
curCursorSalida typCursor;
BEGIN
OPEN curCursorSalida
FOR
SELECT FIPAISID
,FCDESCRIPCION
FROM C3PORTALSOCIO.TACATPAISES;
RETURN curCursorSalida;
END FNCONSPAISES;
Thanks for your help.