1, Entity query:As for the entity query technology, we have already dealt with it many times before, such as the following example:String hql= "from user User";List list=session. CreateQuery (HQL). List ();The result of the above code execution is that all data corresponding to the user entity object is queried, and the data is encapsulated into a user entity object and returned in the list. It is important
Hibernate is equipped with a very powerful query language that looks like SQL. But instead of being fooled by the similarity in grammatical structures, HQL is very conscious of being designed as a fully object-oriented query that can understand concepts such as inheritance, polymorphism, and correlation.Basic rules
The HQL syntax is similar to SQL and is a statement from the select from structure.
Hibernate is equipped with a very powerful query language that looks like SQL. But instead of being fooled by the similarity in grammatical structures, HQL is very conscious of being designed as a fully object-oriented query that can understand concepts such as inheritance, polymorphism, and correlation.Basic rules
The HQL syntax is similar to SQL and is a statement from the select from structure.
Hql:hibernate Query Language.
Characteristics:
>> 1, similar to SQL, the syntax in SQL is basically straightforward to use.
>> 2,sql queries are columns in tables and tables, and HQL queries are objects and properties in objects.
>> 3,hql keywords are case-insensitive, and the class name and property name are case-sensitive.
>> 4,select can be omitted.
1, simple query, employee is entity name
The criteria query encapsulates the query criteria in an object-oriented manner, but HQL (Hibernate query Language) queries provide richer and more flexible query features. As a result, Hibernate makes the HQL query the official recommended standard Query method, HQL query to cover all the functions of the criteria query, provides a similar standard SQL statement
Hibernate (9) HQL query and hibernatehql QueryI. query methods provided by Hibernate
OID query method: Primary Key query. The get () or load () method is used to load the specified OID object and the query result is
HQL Query method: Query using the HQL language through the Query interface
QBC query method: queries by using interfaces and classes such as Crit
I. Introduction of HQLHQL (Hibernate query Language) is an object-oriented query language that relies on the query class, each of which corresponds to a querying object. The query steps are as follows:1) Get Hibernate Session Object2) Writing HQL statements3) Call the session's CreateQuery () method to create a query condition with the HQL statement as the argument4) If the
Chapter 2 mapreduce IntroductionAn ideal part size is usually the size of an HDFS block. The execution node of the map task and the storage node of the input data are the same node, and the hadoop performance is optimal (Data Locality optimization, avoid data transmission over the network ).
Mapreduce Process summary: reads a row of data from a file, map function processing, Return key-value pairs; the system sorts the map results. If there are multi
First, let's take a look at several retrieval methods provided by hibernate:
1. navigation object graph Retrieval Method: navigate to other objects based on the loaded objects. For example, for a loaded customer object, call its getorders (). the iterator () method can be used to navigate to all associated order objects. If a delayed loading search policy is used at the association level, hibernate loads the associated order object from the database. Otherwise, it retrieves the order object from
First, Hibernate provides the Query method
OID Query method: Primary key query. An object that loads the specified OID through the get () or load () method results in a
Hql Query method: query interface using the HQL language
QBC Query method: Through the criteria and other interfaces and classes are query
Local SQL Query method: Query using native SQL language
Object Navigation Que
Hibernate provides a powerful query system. You can use Hibernate's HQL query, conditional query, or even native SQL query statements. The powerful query statements configured by Hibernate during HQL query. HQL is consciously designed to be fully object-oriented queries. It can understand concepts such as inheritance, polymorphism, and association.1.
Hibernate HQL and hibernatehql1. Hibernate HQL explanation 1.1. hql Introduction
Hibernate is equipped with a very powerful Query Language, which looks like SQL. But no
To be confused by syntax-structure similarity, HQL is designed to be fully Object-oriented for queries.
It can understand concepts such as inheritance,
The traditional SQL language uses structured query methods that are powerless to query data that exists in the form of objects. Fortunately, Hibernate provides us with a syntax-like SQL language, Hibernate query Language (HQL), unlike SQL, HQL is an object-oriented query language that can query data that exists in the form of objects. Therefore, this article on how to h
Introduction: Why this demand, from the company's project needs, the company's projects using Java struts2+spring2.5+oracle Middleware tuxedo, database with Oracle, but because not directly connected to the database, with the middleware processing way, And do not want to have too much service, so began to network to find data collation coding. It took about one weeks to complete the task, and now it's all sorted out to share with you. 1. need to import the relevant jar Package : [ alphabetical
Hibernate Run Process:Hibernate role 1, Hibernate is a bridge between Java applications and relational databases, and she is responsible for mapping between Java objects and relational databases. 2. Hibernate internally encapsulates the operation of accessing the database through JDBC, providing an object-oriented data access API to upper-level applications. Hibernate API Introduction 1. Providing access to database operations (Session,transaction,query) 2. Configure Hibernate interf
I accidentally found a very interesting hql usage and shared it with me.
Example:
1. Student database table (MySQL)
CREATE TABLE `student` ( `ID` int(11) NOT NULL, `NAMES` varchar(50) NOT NULL, `AGE` int(3) NOT NULL, PRIMARY KEY (`ID`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Table Data
ID
Names
Age
1
Wang Peng
24
2
Zhang San
12
2. Student object class
@Entity@Table(name = "STUDENT")public class Stude
Excerpt from someone, more useful, more comprehensive.//hql:hibernate Query Language.//Features://>> 1, similar to SQL, the syntax in SQL is basically straightforward to use. //>> 2,sql queries are columns in tables and tables, and HQL queries are objects and properties in objects. //>> 3,hql Keywords are case-insensitive, and the class name and property name are case-sensitive. //>> 4,select can be omitted
HQL is Hibernate query language that is hibernate querying language1. The steps to execute the HQL statement:(1), Get Session objectConfiguration cfg = new configuration ();sessionfactory sessionfactory = Cfg.buildsessionfactory ();Session session = Sessionfactory.getcurrentsession ();(2), write HQL statement(3), create querysession.createquery (
HQL and SQL differencesThe difference between 1.HQL and SQLSQL database Table query HQL Object-oriented queryHql:from followed by the class name + class object where you use the properties of the object to do the condition Sql:from followed by the table name where to use the table field to make the conditional queryWhen you use queries in Hibernate, you typically
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.