Reputation: 5325
I have read Named query. We can use < query> and < sql-query> in mapping file for named query. I cant understand the difference between < query> tag and < sql-query> tag. When we have to use < query> tag and when we have to use < sql-query> tag.
e.g.
<query name="findOneEmp">
<![CDATA[from Employee e where e.empId= :empID]]>
</query>
and
<sql-query name="findEmpNativeSQL">
<return alias="employee" class="com.common.Employee"/>
<![CDATA[select * from employee e where e.empId = :empID]]>
</sql-query>
Upvotes: 0
Views: 1075
Reputation: 6566
Query tag are meant for HQL queries, and Sql-query is meant for declaring the native sql queries.
Upvotes: 1