2 Replies Latest reply on Jan 5, 2011 2:39 PM by daniel jarrett

    native queries with non-persisted values

    daniel jarrett Newbie

      Hi There,


      I am using the following to pull back a list of results and I am pushing the results into my Location class. This all works perfectly.



      Query q = em.createNativeQuery("call mydb.FindLocationsByCoords("+lat+","+lng+","+radius+")", Location.class);
      List<Location> results = q.getResultList(); //from a resultset



      Now I would like to add a property to the Location class for a value which isn't persisted but is returned by my stored proc. This value is "distance", and it represents a calculation in km's that the Location record is from the coordinates entered.


      Can anyone please point me in the right direction as to how I might go about this?