Вопрос

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>
Это было полезно?

Решение

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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top