users@glassfish.java.net

JPQL: Retrieving data from a multi select query

From: <glassfish_at_javadesktop.org>
Date: Sat, 20 Mar 2010 10:00:59 PDT

Hello,

I have a multi select query and I need to retrieve all those fields in an object that will be display in a JSF 2.0 page.

This is my method code but I am afraid it is wrong,

public Map<String, Object> findAllEmailAddress(long employeeId) {
try {
String query = "SELECT EMAIL_TYPE, EMAIL_ADDRESS FROM EMAIL ea " + "INNER JOIN EMPLOYEE emp " +
"ON ea.EMP_ID = emp.EMP_ID " +
"WHERE emp.EMP_ID = " + Long.toString(employeeId);

Query q = em.createNativeQuery(query);
return q.getHints();
} catch (javax.persistence.NoResultException nre) {
return null;
}
}

How do I must to do?

Thanks in advance,
Jose
[Message sent by forum member 'josealvarezdelara']

http://forums.java.net/jive/thread.jspa?messageID=392903