HQL QueryHQL provides a very powerful feature, which is for persistent objects, with the acquisition of objects, without update,delete and insert operations. And the HQL is object-oriented, with inheritance, polymorphism and correlation characteristics. fromclause:The FROM clause is the simplest hql, such as from Student, and can also be written as select S from
The content of this section
Query methods in the NHibernate
NHibernate Query Language (HQL)
1.from clause
2.select clause
3.where clause
4.order BY clause
5.group BY clause
Example analysis
Conclusion
In the previous section, we initially set up a nhibernate program, completed mapping the Customer table and read the data function, this section and the next section we discuss the query method in the N
Hibernate-based Hibernate query language (hql)
HqlKeywords in hql are case-insensitive, but attributes and class names are case-sensitive.1. Simple attribute Query [important]* For a single attribute query, a list of returned result set attributes is returned. The element type is consistent with the corresponding attribute type in the object class.* When querying multiple attributes, the returned collectio
Transferred from: http://www.cnblogs.com/AnswerTheQuestion/p/6512701.htmlThis essay will document Hql's frequently used query statements to facilitate future viewing.Here by defining three classes, special, classroom, student to do the test, special and classroom is a one-to-many, classroom and student is a one-to-many relationship, here just paste the property code of these three beans:Special Class:public class special{ private int id; Private String name; Private String type; Priv
Let's summarize the common syntax of the HQL statement:
FROM clause:;
Select clause: Used to select objects and attributes;
WHERE clause: The restriction condition used to express the query statement;
Use an expression: generally used in the WHERE clause;
ORDER BY clause: used for sorting;
Here is a summary of the HQL query based on a table of one of my projects:
Basic usage of hql
1. Object QueryString hql = "from Tuser ";
Executing this statement will return records of Tuser and Tuser sub-classes.
Hql = "from Java. Lang. Object"Records of all database tables in the database are returned.
Where statementHql = "from Tuser as user where user. Name = 'yyy '";
The same can be omitted for.Hql = "from Tuser user where user. Na
Operators yesterday to ask a question, the table's fuzzy query only support the current page, the query needs a page page of the turn, the user experience needs to be improved. The technical level is because the query invokes the public pagination Pagequery (final criterion[] criterions, final integer startLine, final integer PageS ize, Final String by, final Boolean Isasc) {} method, which is good for single table query support, adding query conditions to criterion array, executing pagequery c
1. Hibernate Query Introduction
Hibernate hql Query, criteria query, call stored procedure
Hibernate transaction management and concurrency control
Hibernate delay loading strategy, crawl strategy, level two cache management
Hibernate consolidation Struts
2. HQL Introduction
hql:hibernate Query Language , which is an object-oriented query Language provided by Hibernate.
(1) Set various query conditions in t
First, batch processing operationsBulk processing of data is the processing of large amounts of data in a transactional scenario. In applications where bulk operations are difficult to avoid,Hibernate provides the following ways to process data in batches:(1) Use HQL The database level for bulk operations(2) Use JDBC API for bulk operations database level(3) Use Session for batch operations will go into cache1. using
The previous article briefly introduced HQL it as Hibernate query language, encapsulated the basic SQL of all query operations, HQL can implement the database file additions and deletions, this article focuses on HQL entity object Query method.first, the Entity object queryEntity object queries are the basis of HQL que
One, Entity object query
Entity object queries are the basis of HQL queries, and as an object query language, the contents of the query string are replaced with the class name and the property name of the class, unlike SQL in query operations. This kind of query method is relatively simple, as long as has the SQL Foundation, uses the HQL is very simple, but some questions need to notice, is the query obtai
Directory structure
Hadoop cluster (CDH4) practice (0) PrefaceHadoop cluster (CDH4) Practice (1) Hadoop (HDFS) buildHadoop cluster (CDH4) Practice (2) Hbasezookeeper buildHadoop cluster (CDH4) Practice (3) Hive BuildHadoop cluster (CHD4) Practice (4) Oozie build
Hadoop cluster (CDH4) practice (0) Preface
During my time as a beginner of
Hibernate is primarily a framework for interacting with databases, and you want to manipulate relational databases in an object-oriented language, as in the next two ways:HQL Statement : Object-oriented Query language, object names are case-sensitive. And unlike SQL, this is where the object is queried, not the table, and polymorphism is supported. HQL mainly through the query operationCriteria Class : is an object-oriented query, the main query crite
In the integration process of SSH framework, novice will often encounter this problem. When we use the HQL statement query, the console error: XXX is not mapped. And at this time, many feel good English students will be dizzy. It then starts by checking that the mapping file for the entity class is *.hbm.xml correct, adding the mapping file to the spring configuration file, and so on. Then highlight a pass, still not effective.Let's get down to the ch
1. Unable to locate appropriate constructor on class ....
Similar to "select new uservo (U. ID, U. Name) from user u where u. ID> 100"
In this case, uservo must have a constructor that matches the (ID, name) type.
2. Like Fuzzy match:
View plaincopy to clipboardprint?
Public list
String hql = "select * from user u where u. name like? "
List
Return result;
}
Public list
Note that "%" is passed in as a parameter rather than directly spelled i
For example, for the Tuser class
1. Object Query
String hql = "from Tuser ";
Executing this statement will return records of Tuser and Tuser sub-classes.
Note: If the Tuser class has a foreign key, an error is returned during the query!
Solution: Select alias. Attribute from class as alias. No alias. Attribute still reports error!
Hql = "from Java. Lang. Object"
Records of all database tables in the databas
Here by defining three classes, special, classroom, student to do the test, special and classroom is a one-to-many, classroom and student is a one-to-many relationship, here just paste the property code of these three beans:Special class: Public class special{ privateint ID; Private String name; Private String type; Private Set Rooms; ..........}Classroom class: Public class classroom{ privateint ID; Private String name; Private special special; Private set stu
HQL multi-table joint query problem HQL multi-Table query only needs to query the expected objects when fromAAAasa, BBBasbwherea. AB. a. When the two objects are retrieved, HQL can write selectafromAAAasa and BBBasbwherea to retrieve only one object. AB. a
HQL multi-table joint query problem
HQL (Hibernate Query Language) Object-oriented query language, unlike SQL, the object names in HQL are case-sensitive (except for Java classes and other parts of the property are not case-sensitive); HQL is the object, not the table, and the polymorphism is supported; HQL is mainly operated by query. How query is creat
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.