-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibernate Stored Procedure - Functions
PostPosted: Fri May 28, 2010 1:28 pm 
Newbie

Joined: Fri May 28, 2010 1:12 pm
Posts: 3
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.