Hibernate is to support SQL statement queries, he calls the original SQL because his writing is not pure SQL ...
I have seen the stage is already confused --_- || (that is! Don't fall)
At the audience has purchased the "人 王" card tomatoes and prepares to transfer to the topic, successful transfer: P
1. Actually the key is to understand the understandion.createsqlquery method, first see the API
CreateSqlQueryPublic Query CreatesqlQuery (String SQL,
String Returnalias,
Class ReturnClass
Create a new installation of
Query for the given sql string.
Parameters:
SQL - a Query Expressed in SQL
RETURNALIAS - A Table Alias That Appears Inside
{} in the SQL STRING
ReturnClass - The Returned Persistent Class
2. Then I draw an example of the example of Hibernate's Reference Document Chapter 13.
You should be able to understand this picture ??!?
2. Now, you can continue to read the Hibernate's reference document Chapter 13 (Hibernate / Doc / Reference / ZH-CN / HTML / QuerySql.html), the complete concept he describes - except for my drawing: d.
3. Related APIs: session.
CreatesqlQuery (String SQL, String [] ReturnaliaS, Class [] ReturnClasses
When you use multiple table queries, use the SESSION interface of this API
CreateSqlQueryPublic Query CreatesqlQuery (String SQL,
String [] RETURNALIASES,
Class [] returnclasses)
Create a new installation of
Query for the given sql string.
Parameters:
SQL - a Query Expressed in SQL
RETURNALIASES - AN Array of Table Aliases That Appear Inside
{} in the SQL STRING
ReturnClasses - The Returned Persistent Classes
4. Others
4.1 Do not query unmapped tables or views.