Tags: blog detail user table call between object-oriented user repo CSDNTransfer from http://blog.csdn.net/aaa1117a8w5s6d/article/details/7757097 the difference between HQL and SQL Tags: sqlhibernatejavasessionuser database 2012-07-17 22:03 11614 People read comments (0) favorite reports Directory (?) [+]HQL is an object-oriented query, format: from + Class name + Class object + where + object properties
The difference between 1.HQL and SQLSQL database-oriented table queryHQL Object-oriented queryHql:from followed by class name + Class object where to use the property of the object to do the conditionSql:from followed by the table name where to use the field in the table to make the conditionInquireWhen you use queries in Hibernate, you typically use HQL query statements.HQL (Hibernate query Language), Hibe
ArticleDirectory
Statement 1: it may cause SQL injection. Do not use it.
Statement 2: Ado. Net style? Parameter. The Nhibernate parameter starts from 0.
Statement 3: The name parameter is represented in the query string in the form of name. In this case, the IQUERY interface binds the actual parameter to the name parameter.
Syntax 4: Name the parameter list. Add some parameters to a set list. For example, you can query whether data is in this set list.
Content of this se
Introduction and basic syntaxHql is case insensitive. When the same entity class name exists, use the package name. entity class.Query query = session. createquery ("from cat c ");List Returns a single object.Query q = session. createquery ("select count (c) from cat c ");Number num = (number) Q. uniqueresult (); // returns a single instanceInt COUNT = num. intvalue (); // return the value.When querying the total number of queries, the hql format must
Hibernate hql query code instance, hibernatehql
This article focuses on the content related to Hibernate hql queries, as detailed below.HQL Introduction
Hibernate Query Language (HQL) is a fully Object-Oriented Query statement with powerful Query functions. It has the characteristics of polymorphism and association, HQL
HQL is short for Hibernate Query Language, that is, hibernate Query Language: HQL adopts the Object-Oriented Query Method. HQL queries provide more abundant and flexible query features. Therefore, Hibernate sets the HQL query method as the standard query method officially recommended.
As a veteran ORM framework, Hibernate's contribution to the database persistence layer is a visible achievement.It provides more and more data query methods, from SQL to self-created HQL to object-oriented standardized queries.Although the query is a bit confusing, the configuration is a bit more complicated to Use.But There's no way to hide its fascinating place, this blog tries to summarize all of Hibernate's Queries.Radish green vegetables each the
Content of this section
The query method in nhib.pdf
Hql)
1. From clause
2. Select clause
3. Where clause
4. Order by clause
5. Group by clause
Instance analysis
Conclusion
In the previous section, we initially set up a Nhibernate program to map the customer table and read data. This section and the next section will be discussed inThe query method in nhib.pdf. Before that, I would like to recall what was completed in the pr
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
1. HQL IntroductionHQL is an object-oriented query language, compared with the SQL query language, although syntactically similar, are run-time parsing, but HQL is not like SQL, such as data tables, columns and other database objects, HQL objects are classes, objects, properties and so on. It can also support inheritance and polymorphism, and
Hibernate hql syntax and related foreign key Association
Hql
For example, for the Tuser class
1. Object QueryString hql = "from user ";
Executing this statement will return records of the user and the user subclass.Note: If the Tuser class has a foreign key, no error will be reported in the query results. However, if the foreign key in the results is null, a null
Hibernate -- HQL, QBC retrieval method, hqlqbc
I. HQL Retrieval Method
Test the HQL retrieval method using a bidirectional one-to-multiple method. Take Department and Employee as examples.
Table creation statement:
CREATE TABLE department( dept_id INT(11) PRIMARY KEY NOT NULL AUTO_INCREMENT, dept_name VARCHAR(50));CREATE INDEX FK_8hf3vewo7w3v9doungcc51wwy O
Background
Based on the previous section, Hibernate (12): HQL query (i), we have learned a part about the use of HQL:
HQL with parameter query
HQL ORDER by Sort query
HQL setting entity parameter queries
This section will learn
Tags: parameter multi-table query string technology share create EXEC field tools factorHQL is an object-oriented query, format: from + Class name + Class object + where + object properties SQL is database-oriented table query, format: from + table name + where + table field1. EnquiryIt is recommended to use HQL (Hibernate query Language) to query statements when using queries in Hibernate. When using HQL y
The previous article discussed in detail the HQL query in the Entity object query, and at the end of the simple introduction of SQL Native Query, HQL is the object query, so in the Query method and SQL may not be the same, in learning to use HQL only need to understand the different points, so you can quickly get started using
SQL: Full-Name Structured Query Language (structured Query Language), a special purpose programming language, is a database query and programming language for accessing data and querying, updating and managing relational database systems , and is also the extension of the database script file. HQL: HQL (Hibernate query Language) query provides richer and more flexible query properties than the criteria quer
1. Non-integrated springHibernate's search method, mainly has the following five kinds.1. Navigation object Graph retrieval method. (Navigate to other objects based on the objects that have already been loaded.) )2.OID retrieval method. (objects are retrieved according to the OID of the object.) )3.HQL retrieval method. (Use the object-oriented HQL query language.) )4.QBC retrieval method. (Use the QBC (Qur
Overview
Hibernate provides the following ways to retrieve objects1) The Navigation object graph retrieves the way: navigates to other objects according to the already loaded object;2)oid Retrieval Method: The object is retrieved according to the OID of the object;3)hql retrieval Method: Using object-oriented HQL query language;4)QBC Retrieval method: Use the QBC (Query by Criteria) API to retrieve the
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.