3 Replies Latest reply on Jul 17, 2008 1:58 PM by EC Admin

    Problem with Native Queries

    EC Admin Newbie

      Hi guys,

      I'm trying to execute a simple native query using JBoss 4.0.5GA and EJB 3.0.

      Here is my entity bean with the SqlResultSetMapping annotation:

      @SqlResultSetMapping(name="poiResultsMapping",
       entities=@EntityResult(entityClass=POI.class,
       fields=@FieldResult(name="name", column="POI_NAME")))
      @Entity
      public class POI implements java.io.Serializable { ... }


      Here is the native query which fails in the session bean.

      q = em.createNativeQuery("select p.POI_NAME from poi as p limit 8", "poiResultsMapping");
      
      this.poiResults = q.getResultList();
      


      This is the cause of the error :

      2007-09-17 13:36:53,608 INFO [org.hibernate.type.LongType] could not read column value from result set: POI2_12_0_;


      Do you see what could be wrong with this code ? Did I forget something ?

      Regards.