Your other option is to do a "new BrowserDetailItem(s.name, s.id)" in your
query string.
On Tuesday, May 15, 2012 3:23:43 PM UTC-5, jmbz84 wrote:
>
> Solved it.
>
> The problem was in: tempList = query.getResultList();
>
> The result list returned from the query is a List<Object[][]> which
> couldn't be converted to List<BrowserDetailItem>.
>
> This meant that the return method instead of returning a
> List<BrowserDetailItem> which is a ValueProxy, returned a List<Object[]
> []> which can't be sent to the server.
>
> The solution was to iterate though the List<Object[][]> and create a
> new BrowserDetailItem in each pass:
>
> Query query = entityManager
> .createQuery("SELECT s.name,s.id FROM Song s,
> Playlist p, Composer c WHERE s.id_playlist = p.id AND c.id =
> p.id_composer ");
>
> List results = query.getResultList(); // Fetches
> list containing
> arrays of object
>
> Iterator it = results.iterator();
>
> while (it.hasNext()) {
>
> Object[] result = (Object[]) it.next(); //
> Iterating through the
> array object
>
> tempList.add(new BrowserDetailItem
> ((String) result[0], (Integer)
> result[1]));
> }
>
> tempList.size();
>
> return tempList;
>
> Hope it helps.
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-web-toolkit/-/sqiT2WCttWoJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.