Does hibernate query result always return a list?
- by Phoenix
Does a query execution always have to return a list ? How do I replace the code below if I am sure it will only return a single object ?
@Override
public List<DocInfo> findAllByDocId(String docId)
{
Query q = getCurrentSession().createQuery("from DocInfo item where item.id = :docId");
q.setString("docId", docId);
List<DocInfo> docInfoList = q.list();
return docInfoList;
}