Lhibernate a total of 5 query methods? OID Data Query method? HQL Data Query method? QBC Data Query method? Local SQL Query method? Ogn Data Query methodOID Data Query methodL Premise: The OID of the object has been acquiredL Query: Based on OID, use the Get/load method to query the corresponding dataL Function: Use OID to get corresponding dataHQL Data Query methodL Premise: The data structure and conditions are known to be queriedL Query: Based on Q
1 //hql:hibernate Query Language. 2 //Features:3 //>> 1, similar to SQL, the syntax in SQL is basically straightforward to use. 4 //>> 2,sql queries are columns in tables and tables, and HQL queries are objects and properties in objects. 5 //>> 3,hql Keywords are case-insensitive, and the class name and property name are case-sensitive. 6 //>> 4,select can be omitted. 7
HQL refers to hibernate query Language, which is hibernate queries the language, has a set of its own query mechanism, its query statements and SQL is very similar, in use can quickly get started. HQL provides essentially all of SQL's query functionality, but there are a lot of places to be aware of when using HQL queries, and this article collates some of the ba
Hibernate provides the following ways to retrieve objects(1) Navigation object Graph retrieval method: Navigating to other objects based on objects that have already been loaded(2) OID retrieval method: Retrieving objects 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 object. Th
HQL data query for Hibernate, hibernatehql
1. HQL Introduction
HQL is an Object-Oriented Query Language. Compared with SQL query language, although it is similar in syntax, it parses data tables at runtime, but HQL does not operate on data tables as SQL does, database objects such as columns. The objects operated by
Object Query
Example 1: hql
Code
String hql = "from user ";
List list = session. createquery (hql). List ();
String hql = "from user"; List list = session. createquery (hql). List ();
Because hql statements ar
Hql:hibernate Query Language (Hibernate-specific querying language)HQL is an object-based query language, and its syntax is similar to SQL, but he differs from SQL in that SQL is a table-and field-oriented query, and HQL is an object-and attribute-oriented query.Demand 1. Find out all the items@Test Public voidTestfindallporject () {//Get Hibernate sessionSession session =hibernateutils.getsession (); //Def
1. Querying all fields of the entire mapping object
The direct from query is a mapping object, that is: querying the entire Mapping object all fields
String hql = "from Users";
Query query = session.createquery (HQL);
list
2. Querying a single field
Query single field
String hql = "SELECT name from Users";
DirectoryWrite in frontDocumentation and series articlesSeveral ways to queryHQL QueryAn exampleSummarizeWrite in frontThe previous article introduced the basic configuration of NHibernate in the project, including the setting of the database connection string, the configuration of the mapping file, and the place to be aware, this article describes the NHibernate query method.Documentation and series articles[Nhibernate] Architecture[NHibernate] Isessionfactory Configuration[NHibernate] Persiste
Last time we learned to use the criteria for the relevant operations, but because the criteria is not hibernate the official recommendation of the query, we do not use much. Now let's take a look at the official hql and learn about its strength.Say is HQL, namely Hibernate query statement, and SQL what is the difference? The difference of a letter, haha.Of course not, the difference between
This note continues to use the Dept Department table, EMP staff table, one-to-many pair of bidirectional mappings.1 Conditional query1.1 Query Employee Form EMP Age eage less than 30, monthly esal greater than 20000 employee name EnameSql:select ename from EMP where eageHql:select ename from Emp where eage1.2 Settings and aliases for question marksQuestion mark (? ) is set using the. Setparameter (position, property value) The position of the question mark in the SQL statement is starting at 1 a
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
The previous section describes the most basic entity classes. This section describes the HQL statement constructor, including query and update.
Advantages: It is faster to construct HQL statements in an object-oriented manner and does not require manual HQL concatenation.
Disadvantages: Encapsulation may reduce performance and only supports common and simple
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
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 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.