Is there anything to stop you defining an class/entity {answer: String, countAnswer: Int} and to directly create it from JPA (of course, it's read only).
On Wed, Apr 22, 2009 at 9:36 AM, Charles F. Munat <c...@munat.com> wrote: > > I was thinking tuples, but that didn't work. I'll try your suggestion. > BTW, for anyone reading along, I forgot the group by clause in the query > below. > > Chas. > > Derek Chen-Becker wrote: > > I think that the type would be Array[Any] and you'll get one String and > > Int for each row. > > > > Derek > > > > On Tue, Apr 21, 2009 at 3:37 PM, Charles F. Munat <c...@munat.com > > <mailto:c...@munat.com>> wrote: > > > > > > Anyone have a quick example of how to run a scalar query in JPA? I > can't > > find anything in the JPA demo. > > > > I have this query: > > > > select t.answer, count(distinct answer) from Vote t where t.poll = > :poll > > order by t.answer > > > > but how do I call it? I normally do: > > > > Model.createNamedQuery[...]("findVoteCountAnswersByPoll", "poll" -> > > poll).findAll > > > > But what is the type? And how do I get the results back out? > > > > I know I did this once before somewhere, but I can't remember where > and > > I can't find it. > > > > Thanks! > > > > Chas. > > > > > > > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~----------~----~----~----~------~----~------~--~---