Well, it leaves this way,
public List<String[]> 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 (List<String[]>)q.getResultList();
} catch (javax.persistence.NoResultException
nre) {
return null;
}
}
and the JSF page is as follows,
< h:outputLabel value="Email
Address:"/>
<c:forEach items="#{employee.allEmailAddress}" var="emailArray">
<c:out value="${emailArray[0]}"/>
<br/>
<c:out value="${emailArray[1]}"/>
</c:forEach>
Hope this
helps.
Jose
Sent: Saturday, March 20, 2010 6:05 PM
Subject: [eclipselink-users] JPQL: Retrieving data from a multi
select query
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
_______________________________________________ eclipselink-users
mailing
list eclipselink-users@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/eclipselink-users
|