Apartado 3.6: Conceptos Avanzados de Hibernate
Apartado 3.6: Conceptos Avanzados de Hibernate
Apartado 3.6: Conceptos Avanzados de Hibernate
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Más sobre HQL – Aspectos generales (4)<br />
<br />
Proyecciones (cont)<br />
<br />
Si se <strong>de</strong>sea, no es necesario emplear expresiones<br />
constructor<br />
SELECT d.name, d.creationDate FROM Department d<br />
<br />
<br />
<br />
Cada elemento <strong>de</strong>vuelto por Query.list, o el único elemento<br />
<strong>de</strong>vuelto por Query.uniqueResult (aunque en este ejemplo<br />
no es aplicable), es una instancia <strong>de</strong> Object[]<br />
Cada elemento <strong>de</strong>l vector correspon<strong>de</strong> a un elemento (en el<br />
mismo or<strong>de</strong>n que figura en la consulta)<br />
En el ejemplo<br />
Cada elemento <strong>de</strong> la lista <strong>de</strong>vuelta por Query.list() es una<br />
instancia <strong>de</strong> Object[]<br />
Cada Object[] tiene dos elementos: el nombre y la fecha (en<br />
este or<strong>de</strong>n), <strong>de</strong> tipo String y Calendar, respectivamente