I have the below hibernate native query as shown below the idea is not to use the native query and switch to hibernate criteria api
<![CDATA[select count(iilnmp.INV_LINE_NOTE_ID) from IOA_INV_LINE_NOTE_MAP iilnmp ,
IOA_INVOICE_LINE_NOTES iiln , IOA_INVOICE_LINE iil
where iilnmp.INV_LINE_NOTE_ID = iiln.ID and iiln.INLI_ID =iil.id and iil.ID = ?]]>
which i am calling from a method as shown below now my query is that instead of having native query can i use criteria also to achieve the same result
public int findAttachementsCount(long id)
{
Query query = session.getNamedQuery("attachmentQuery");
query.setParameter(0, id);
int attachCount = query.list().size();
return attachCount;
}
Folks please advise for this. Can somebody please look this into priority..!!