0

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>
Viraj Dhamal
  • 5,165
  • 10
  • 32
  • 41

1 Answers1

1

Query tag are meant for HQL queries, and Sql-query is meant for declaring the native sql queries.

Zeus
  • 6,386
  • 6
  • 54
  • 89