Hi, everybody, i have a question about performance loading objects.
How method is better??? Load a perssisted object by query or by load method?????.
Examples:
// session is an instance of Session class.
Query query = session.getNamedQuery("subsidios.practicas.x.pk");
query.setLong(0, dto.getNumero().longValue());
java.util.Iterator it = query.iterate();
// Code from named query
<query name="subsidios.practica.x.pk"><![CDATA[
from Practica as p
where p.numero = ?
]]>
</query>
The second choice:
// dto.getNumero() returns the long id
Practica p = (Practica) session.load(Practica.class, dto.getNumero());
Thanks for all suggestions!!!!.
|