To implement a slightly more complex query in the ActiveRecord, we cannot use the Find (ID), findall () two static methods, then we need to use the HQL statement to implement, In the usual use of castle I think we all notice under the Activerecordbase class, because only provide find (ID), findall () such as two static query methods, these two methods in our query is not enough, Still cannot solve some complex queries in the actual development, this aspect ActiveRecord has provided the HQL language support for us.
I. Introduction to the HQL statement
The HQL full name is Hibernate query Language, which is a fully object-oriented query language. Let's take a look at some of the most basic uses of HQL (like SQL):
The FROM clause--------> such as: From name, also desirable for aliases such as from name as name, or as, such as from name name.
SELECT clause-----> such as: Select Name from TableName.
WHERE clause---> such as: From TableName as TN where TN. The Name is not null.
Use aggregate functions--> such as: Select * from Table as T.
......
For more hql use, please refer to the relevant information, this is not described in detail.