Home
16.
What do you mean by Named – SQL query?
Named SQL queries are defined in the mapping xml document and called wherever required. Example:

      SELECT emp.EMP_ID AS {emp.empid},
                 emp.EMP_ADDRESS AS {emp.address},
                 emp.EMP_NAME AS {emp.name} 
      FROM Employee EMP WHERE emp.NAME LIKE :name

Invoke Named Query :
List people = session.getNamedQuery("empdetails")
		     .setString("TomBrady", name)
            	     .setMaxResults(50)
		     .list();

17.
How do you switch between relational databases without code changes?
Using Hibernate SQL Dialects , we can switch databases. Hibernate will generate appropriate hql queries based on the dialect defined.
18.
If you want to see the Hibernate generated SQL statements on console, what should we do?
In Hibernate configuration file set as follows:
<property name="show_sql">true</property>
19.
What are derived properties?
The properties that are not mapped to a column, but calculated at runtime by evaluation of an expression are called derived properties. The expression can be defined using the formula attribute of the element.
20.
What are the Collection types in Hibernate ?
  1. Bag
  2. Set
  3. List
  4. Array
  5. Map