0 Replies Latest reply on Sep 20, 2005 1:46 PM by Alfredo Anderson

    NamedNativeQuery annotation callable attribute support

    Alfredo Anderson Newbie

      I'm trying to retrieve data from a stored procedure.
      It works fine when the SP hasn't parameters but I can't make it work for an SP that do have them.
      I think that the problem may be that the default NamedNativeQuery annotation doesn't support the callable attribute and the hibernate-anotation.jar included in the jboss-4.0.3RC2 does not include org.hibernate.annotations.NamedNativeQuery which supports it.
      Can anyone tell if this is the problem ?

      More info

      * Stateless Bean

      This works

      public Collection getSP() {
      Query q = em.createNativeQuery("sp_fund", "getFunds");
      return q.getResultList() ;
      }

      this doesn't

      public Collection getSP2() {
      // I've tried multiple forms of the next two lines
      Query q = em.createNativeQuery("sp_fund2(?)", "getFunds");
      q.setParameter(0, 1) ;
      return q.getResultList() ;
      }

      * Entity Bean Annotation

      @SqlResultSetMapping(
      name="getFunds", entities =
      @EntityResult(name="entity.beans.Fund", fields= {
      @FieldResult(name="id", column="id"),
      @FieldResult(name="name", column="name"),
      @FieldResult(name="growthrate", column="growthrate")
      }
      )
      )