Hi , Please tell me what is the reason for using HQL , when the same thing can be done with the help of normal SQL query.
Sessions createSQLQuery()
Thanks in advance .
Sessions createSQLQuery()
Thanks in advance .
Kieren Johnson wrote:HQL does not refer directly to tables in the database but instead refers to the classes that these tables are mapped to in your hibernate mapping files (or annotations). This means that your code does not need to know anything about the database that it is attached to and this is a good thing.
If you decided to port your application to another database system and, in a fit of madness, to change all the table names then all you need to change in your application are the hibernate mappings, you wouldn't need to touch any part of your code. Neat, huh?