[jboss-user] [EJB 3.0] - Problem with Native Queries

rcherchi do-not-reply at jboss.com
Mon Sep 17 09:25:25 EDT 2007


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.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4085040#4085040

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4085040



More information about the jboss-user mailing list