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
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
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
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 (Hibernate Query Language). The traditional SQL language uses structured query methods, which can do little to the data that exists in the form of objects. To do this, Hibernate provides us with a syntax-like SQL language, which is HQL (Hibernate query language), unlike SQL, HQL is an object-oriented query language that can query data that exists as an object
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
After the project is moved from TOMCAT7 to WEBLOGIC12C, the exception org. hibernate. QueryException: ClassNotFoundException occurs:
Org. hibernate. hql. ast. HqlToken;
I checked on the Internet, because hibernate3.0 is based on anlr HQL/SQL query translator, using antlr-x-x-x.jar, however weblogic. jar already contains the antrl class library, and weblogic. the jar loading sequence is limited than the jar
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
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";
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.