openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pinaki Poddar <ppod...@apache.org>
Subject Re: Can;t map AVG sql field to class
Date Fri, 21 Nov 2008 19:40:53 GMT

Hi,
  The source of the problem seems to be
   > Query query = em.createNativeQuery(sb.toString(), InformerRow.class);

  Your query returns s5 - a Number. 

  While the above code is saying that the query result is an instance of
InformerRow.
 
  So try something like:
   Query query  = em.createNativeQuery(sb.toString());
   Object result = query.getSingleResult();
   InformerRow ir = new InformerRow();
   ir.s5 = ((Number)result).intValue();

-- 
View this message in context: http://n2.nabble.com/Can-t-map-AVG-sql-field-to-class-tp1562523p1563189.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Mime
View raw message