Please send your Questions & Answers or Feedback to ""

What is meant by a Named SQL Query in hibernate and how it's used?

Named SQL queries are those queries which are defined in mapping file and are called as required anywhere.

For example, we can write a SQL query in our XML mapping file as follows:

<sql-query name = "studentdetails">

<return alias="std"/>


std.STUDENT_DISCIPLINE AS {std.discipline},

FROM Student std WHERE std.NAME LIKE :name


Then this query can be called as follows:

List students = session.getNamedQuery(&amp;quot;studentdetails&amp;quot;)

 .setString(&amp;quot;TomBrady&amp;quot;, name)



Related Posts Plugin for WordPress, Blogger...
Flag Counter