Paul Z. Wu
2013-11-27 17:42:35 UTC
I tried this:
TypedQuery<Object[]> q = em.createQuery("select distinct t.listName, t.word from WordList t", Object[].class);
out.println(q.getResultList().size() +"<br/>") ;
for (Object[] e: q.getResultList())
{
out.println(e[0] +".."+ e[1] + "<br/>");
}
I got the result:
5
test..word
test..word
test..word
test..word
test..word
What is the proper way to get only one row?
Paul Z. Wu
http://www.elookinto.com
TypedQuery<Object[]> q = em.createQuery("select distinct t.listName, t.word from WordList t", Object[].class);
out.println(q.getResultList().size() +"<br/>") ;
for (Object[] e: q.getResultList())
{
out.println(e[0] +".."+ e[1] + "<br/>");
}
I got the result:
5
test..word
test..word
test..word
test..word
test..word
What is the proper way to get only one row?
Paul Z. Wu
http://www.elookinto.com