String hqlQuery="from PreferentialTariffDTO pref where pref.hsCodeList.prefId=pref.prefId and pref.cpcCode='"+cpcCode+"' and pref.hsCodeList.hsCode='"+hsCode+"'";
is above hql query is right or wrong?
there PreferentialTariffDTO is the parent table pojo class.
and hsCodeList is the child table PrefHSDetailDTO.
now i need to pick the records which satisfy the above conditions.
Well, what Exception are you getting? The full stack trace. And don't cobble together statements like that unless you want sporadic SQL syntax errors or want to allow SQL Injection attacks. Use PreparedStatement (properly).
Edit: P.S. if you question concerns syntax alone, find an SQL forum.