{"id":50723,"date":"2023-12-23T10:31:39","date_gmt":"2023-12-23T02:31:39","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/hql-hibernate%e6%9f%a5%e8%af%a2%e8%af%ad%e8%a8%80-%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/"},"modified":"2023-12-23T15:35:49","modified_gmt":"2023-12-23T07:35:49","slug":"hql-hibernate%e6%9f%a5%e8%af%a2%e8%af%ad%e8%a8%80-%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/hql-hibernate%e6%9f%a5%e8%af%a2%e8%af%ad%e8%a8%80-%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/","title":{"rendered":"HQL &#8211; Hibernate\u67e5\u8be2\u8bed\u8a00 &#8211; \u793a\u4f8b\u6559\u7a0b"},"content":{"rendered":"<p>HQL\u6216Hibernate\u67e5\u8be2\u8bed\u8a00\u662fHibernate\u6846\u67b6\u7684\u9762\u5411\u5bf9\u8c61\u67e5\u8be2\u8bed\u8a00\u3002HQL\u4e0eSQL\u975e\u5e38\u76f8\u4f3c\uff0c\u53ea\u662f\u6211\u4eec\u4f7f\u7528\u5bf9\u8c61\u800c\u4e0d\u662f\u8868\u540d\uff0c\u4f7f\u5176\u66f4\u63a5\u8fd1\u9762\u5411\u5bf9\u8c61\u7684\u7f16\u7a0b\u3002<\/p>\n<h2>Hibernate\u67e5\u8be2\u8bed\u8a00\uff08HQL\uff09<\/h2>\n<p>HQL\u548c\u5927\u5c0f\u5199\u654f\u611f\u6027\uff1a\u9664\u4e86Java\u7c7b\u540d\u548c\u53d8\u91cf\u540d\u4e4b\u5916\uff0cHQL\u662f\u5927\u5c0f\u5199\u4e0d\u654f\u611f\u7684\u3002\u56e0\u6b64\uff0cSeLeCT\u4e0esELEct\u4e0eSELECT\u662f\u76f8\u540c\u7684\uff0c\u4f46com.Olivia.model.Employee\u4e0ecom.Olivia.model.EMPLOYEE\u662f\u4e0d\u540c\u7684\u3002HQL\u4e2d\u5e38\u89c1\u652f\u6301\u7684\u5b50\u53e5\u6709\uff1a<\/p>\n<ol>HQL\u7684From\u5b50\u53e5\uff1aHQL\u7684From\u5b50\u53e5\u4e0eSQL\u4e2d\u7684select\u5b50\u53e5\u76f8\u540c\uff0cfrom Employee\u5219\u4e0eselect * from Employee\u76f8\u540c\u3002\u6211\u4eec\u8fd8\u53ef\u4ee5\u521b\u5efa\u522b\u540d\uff0c\u4f8b\u5982from Employee emp\u6216from Employee as emp\u3002<br \/>\nHQL\u7684Join\u8bed\u53e5\uff1aHQL\u652f\u6301\u5185\u8fde\u63a5\u3001\u5de6\u5916\u8fde\u63a5\u3001\u53f3\u5916\u8fde\u63a5\u548c\u5168\u8fde\u63a5\u3002\u4f8b\u5982\uff0cselect e.name, a.city from Employee e INNER JOIN e.address a\u3002\u5728\u8fd9\u4e2a\u67e5\u8be2\u4e2d\uff0cEmployee\u7c7b\u5e94\u8be5\u6709\u4e00\u4e2a\u540d\u4e3aaddress\u7684\u53d8\u91cf\u3002\u6211\u4eec\u5c06\u5728\u793a\u4f8b\u4ee3\u7801\u4e2d\u8be6\u7ec6\u4ecb\u7ecd\u3002<br \/>\n\u805a\u5408\u51fd\u6570\uff1aHQL\u652f\u6301\u5e38\u7528\u7684\u805a\u5408\u51fd\u6570\uff0c\u5982count(*)\u3001count(distinct x)\u3001min()\u3001max()\u3001avg()\u548csum()\u3002<br \/>\n\u8868\u8fbe\u5f0f\uff1aHQL\u652f\u6301\u7b97\u672f\u8868\u8fbe\u5f0f\uff08+\u3001-\u3001*\u3001\/\uff09\u3001\u4e8c\u8fdb\u5236\u6bd4\u8f83\u8fd0\u7b97\u7b26\uff08=\u3001>=\u3001<=\u3001<>, !=\u3001like\uff09\u3001\u903b\u8f91\u64cd\u4f5c\uff08and\u3001or\u3001not\uff09\u7b49\u3002<br \/>\nHQL\u8fd8\u652f\u6301order by\u548cgroup by\u5b50\u53e5\u3002<br \/>\nHQL\u4e5f\u652f\u6301\u50cfSQL\u67e5\u8be2\u4e00\u6837\u7684\u5b50\u67e5\u8be2\u3002<br \/>\nHQL\u652f\u6301DDL\u3001DML\u548c\u6267\u884c\u5b58\u50a8\u8fc7\u7a0b\u3002<\/ol>\n<p>\u8ba9\u6211\u4eec\u6765\u770b\u4e00\u4e2a\u5728\u6211\u4eec\u7684\u7a0b\u5e8f\u4e2d\u4f7f\u7528HQL\u7684\u7b80\u5355\u4f8b\u5b50\u3002<\/p>\n<h3>HQL \u793a\u4f8b\u6570\u636e\u5e93\u7684\u8bbe\u7f6e<\/h3>\n<p>\u6211\u5728\u6211\u7684\u793a\u4f8b\u4e2d\u4f7f\u7528MySQL\u6570\u636e\u5e93\uff0c\u4e0b\u9762\u7684\u811a\u672c\u5c06\u521b\u5efa\u4e24\u4e2a\u8868\uff1aEmployee\u548cAddress\u3002\u5b83\u4eec\u4e4b\u95f4\u662f\u4e00\u5bf9\u4e00\u7684\u6620\u5c04\uff0c\u6211\u6b63\u5728\u63d2\u5165\u4e00\u4e9b\u6f14\u793a\u6570\u636e\u4f9b\u6211\u7684\u793a\u4f8b\u4f7f\u7528\u3002<\/p>\n<pre class=\"post-pre\"><code>CREATE TABLE `Employee` (\r\n  `emp_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\r\n  `emp_name` varchar(20) NOT NULL,\r\n  `emp_salary` double(10,0) NOT NULL DEFAULT '0',\r\n  PRIMARY KEY (`emp_id`)\r\n) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;\r\n \r\nCREATE TABLE `Address` (\r\n  `emp_id` int(11) unsigned NOT NULL,\r\n  `address_line1` varchar(50) NOT NULL DEFAULT '',\r\n  `zipcode` varchar(10) DEFAULT NULL,\r\n  `city` varchar(20) DEFAULT NULL,\r\n  PRIMARY KEY (`emp_id`),\r\n  CONSTRAINT `emp_fk_1` FOREIGN KEY (`emp_id`) REFERENCES `Employee` (`emp_id`)\r\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;\r\n\r\nINSERT INTO `Employee` (`emp_id`, `emp_name`, `emp_salary`)\r\nVALUES\r\n\t(1, 'Pankaj', 100),\r\n\t(2, 'David', 200),\r\n\t(3, 'Lisa', 300),\r\n\t(4, 'Jack', 400);\r\n\r\n\r\nINSERT INTO `Address` (`emp_id`, `address_line1`, `zipcode`, `city`)\r\nVALUES\r\n\t(1, 'Albany Dr', '95129', 'San Jose'),\r\n\t(2, 'Arques Ave', '95051', 'Santa Clara'),\r\n\t(3, 'BTM 1st Stage', '560100', 'Bangalore'),\r\n\t(4, 'City Centre', '100100', 'New Delhi');\r\n\t\r\ncommit;\r\n<\/code><\/pre>\n<p>\u5728Eclipse\u6216\u60a8\u6b63\u5728\u4f7f\u7528\u7684IDE\u4e2d\u521b\u5efa\u4e00\u4e2aMaven\u9879\u76ee\uff0c\u6211\u4eec\u7684\u6700\u7ec8\u9879\u76ee\u5c06\u770b\u8d77\u6765\u50cf\u4e0b\u9762\u7684\u56fe\u50cf\u3002<\/p>\n<h3>\u6f5c\u4f0f\u7684Maven\u4f9d\u8d56<\/h3>\n<p>\u6211\u4eec\u6700\u7ec8\u7684pom.xml\u6587\u4ef6\u5305\u542b\u4e86Hibernate\u548cMySQL\u9a71\u52a8\u7684\u4f9d\u8d56\u3002<\/p>\n<pre class=\"post-pre\"><code>&lt;project xmlns=\"https:\/\/maven.apache.org\/POM\/4.0.0\" xmlns:xsi=\"https:\/\/www.w3.org\/2001\/XMLSchema-instance\" xsi:schemaLocation=\"https:\/\/maven.apache.org\/POM\/4.0.0 https:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd\"&gt;\r\n  &lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;\r\n  &lt;groupId&gt;com.Olivia.hibernate&lt;\/groupId&gt;\r\n  &lt;artifactId&gt;HQLExample&lt;\/artifactId&gt;\r\n  &lt;version&gt;0.0.1-SNAPSHOT&lt;\/version&gt;\r\n  &lt;dependencies&gt;\r\n  \t&lt;dependency&gt;\r\n  \t\t&lt;groupId&gt;org.hibernate&lt;\/groupId&gt;\r\n  \t\t&lt;artifactId&gt;hibernate-core&lt;\/artifactId&gt;\r\n  \t\t&lt;version&gt;4.3.5.Final&lt;\/version&gt;\r\n  \t&lt;\/dependency&gt;\r\n  \t&lt;dependency&gt;\r\n  \t\t&lt;groupId&gt;mysql&lt;\/groupId&gt;\r\n  \t\t&lt;artifactId&gt;mysql-connector-java&lt;\/artifactId&gt;\r\n  \t\t&lt;version&gt;5.0.5&lt;\/version&gt;\r\n  \t&lt;\/dependency&gt;\r\n  &lt;\/dependencies&gt;\r\n&lt;\/project&gt;\r\n<\/code><\/pre>\n<h3>Hibernate \u914d\u7f6e\u6587\u4ef6 (Hibernate Configuration XML)<\/h3>\n<p>\u6211\u4eec\u7684Hibernate\u914d\u7f6eXML\u6587\u4ef6\u5305\u542b\u4e0e\u6570\u636e\u5e93\u8fde\u63a5\u76f8\u5173\u7684\u5c5e\u6027\u548c\u6620\u5c04\u7c7b\u3002\u6211\u5c06\u4f7f\u7528\u6ce8\u91ca\u8fdb\u884cHibernate\u6620\u5c04\u3002hibernate.cfg.xml\u4ee3\u7801\uff1a<\/p>\n<pre class=\"post-pre\"><code>&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n&lt;!DOCTYPE hibernate-configuration PUBLIC\r\n\t\t\"-\/\/Hibernate\/Hibernate Configuration DTD 3.0\/\/EN\"\r\n\t\t\"https:\/\/hibernate.org\/dtd\/hibernate-configuration-3.0.dtd\"&gt;\r\n&lt;hibernate-configuration&gt;\r\n    &lt;session-factory&gt;\r\n        &lt;property name=\"hibernate.connection.driver_class\"&gt;com.mysql.jdbc.Driver&lt;\/property&gt;\r\n        &lt;property name=\"hibernate.connection.password\"&gt;pankaj123&lt;\/property&gt;\r\n        &lt;property name=\"hibernate.connection.url\"&gt;jdbc:mysql:\/\/localhost\/TestDB&lt;\/property&gt;\r\n        &lt;property name=\"hibernate.connection.username\"&gt;pankaj&lt;\/property&gt;\r\n        &lt;property name=\"hibernate.dialect\"&gt;org.hibernate.dialect.MySQLDialect&lt;\/property&gt;\r\n        \r\n        &lt;property name=\"hibernate.current_session_context_class\"&gt;thread&lt;\/property&gt;\r\n        &lt;property name=\"hibernate.show_sql\"&gt;true&lt;\/property&gt;\r\n        \r\n        &lt;mapping class=\"com.Olivia.hibernate.model.Employee\"\/&gt;\r\n        &lt;mapping class=\"com.Olivia.hibernate.model.Address\"\/&gt;\r\n    &lt;\/session-factory&gt;\r\n&lt;\/hibernate-configuration&gt;\r\n<\/code><\/pre>\n<h3>Hibernate\u7684SessionFactory\u5b9e\u7528\u7c7b<\/h3>\n<p>\u6211\u4eec\u6709\u4e00\u4e2a\u5b9e\u7528\u7c7b\u6765\u914d\u7f6eHibernate\u7684SessionFactory\u3002<\/p>\n<pre class=\"post-pre\"><code>package com.Olivia.hibernate.util;\r\n\r\nimport org.hibernate.SessionFactory;\r\nimport org.hibernate.boot.registry.StandardServiceRegistryBuilder;\r\nimport org.hibernate.cfg.Configuration;\r\nimport org.hibernate.service.ServiceRegistry;\r\n\r\npublic class HibernateUtil {\r\n\r\n\tprivate static SessionFactory sessionFactory;\r\n\t\r\n\tprivate static SessionFactory buildSessionFactory() {\r\n        try {\r\n            \/\/ Create the SessionFactory from hibernate.cfg.xml\r\n        \tConfiguration configuration = new Configuration();\r\n        \tconfiguration.configure(\"hibernate.cfg.xml\");\r\n        \tSystem.out.println(\"Hibernate Configuration loaded\");\r\n        \t\r\n        \tServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build();\r\n        \tSystem.out.println(\"Hibernate serviceRegistry created\");\r\n        \t\r\n        \tSessionFactory sessionFactory = configuration.buildSessionFactory(serviceRegistry);\r\n        \t\r\n            return sessionFactory;\r\n        }\r\n        catch (Throwable ex) {\r\n            System.err.println(\"Initial SessionFactory creation failed.\" + ex);\r\n            ex.printStackTrace();\r\n            throw new ExceptionInInitializerError(ex);\r\n        }\r\n    }\r\n\t\r\n\tpublic static SessionFactory getSessionFactory() {\r\n\t\tif(sessionFactory == null) sessionFactory = buildSessionFactory();\r\n        return sessionFactory;\r\n    }\r\n}\r\n<\/code><\/pre>\n<h3>\u4f7f\u7528\u57fa\u4e8e\u6ce8\u91ca\u7684\u6620\u5c04\u7684\u6a21\u578b\u7c7b<\/h3>\n<p>\u6211\u4eec\u5e26\u6709JPA\u6ce8\u89e3\u7684\u6a21\u578b\u7c7b\u5982\u4e0b\u6240\u793a\u3002<\/p>\n<pre class=\"post-pre\"><code>package com.Olivia.hibernate.model;\r\n\r\nimport javax.persistence.Column;\r\nimport javax.persistence.Entity;\r\nimport javax.persistence.GeneratedValue;\r\nimport javax.persistence.GenerationType;\r\nimport javax.persistence.Id;\r\nimport javax.persistence.OneToOne;\r\nimport javax.persistence.Table;\r\n\r\nimport org.hibernate.annotations.Cascade;\r\n\r\n@Entity\r\n@Table(name = \"EMPLOYEE\")\r\npublic class Employee {\r\n\r\n\t@Id\r\n\t@GeneratedValue(strategy = GenerationType.IDENTITY)\r\n\t@Column(name = \"emp_id\")\r\n\tprivate long id;\r\n\r\n\t@Column(name = \"emp_name\")\r\n\tprivate String name;\r\n\r\n\t@Column(name = \"emp_salary\")\r\n\tprivate double salary;\r\n\r\n\t@OneToOne(mappedBy = \"employee\")\r\n\t@Cascade(value = org.hibernate.annotations.CascadeType.ALL)\r\n\tprivate Address address;\r\n\r\n\tpublic long getId() {\r\n\t\treturn id;\r\n\t}\r\n\r\n\tpublic void setId(long id) {\r\n\t\tthis.id = id;\r\n\t}\r\n\r\n\tpublic Address getAddress() {\r\n\t\treturn address;\r\n\t}\r\n\r\n\tpublic void setAddress(Address address) {\r\n\t\tthis.address = address;\r\n\t}\r\n\r\n\tpublic String getName() {\r\n\t\treturn name;\r\n\t}\r\n\r\n\tpublic void setName(String name) {\r\n\t\tthis.name = name;\r\n\t}\r\n\r\n\tpublic double getSalary() {\r\n\t\treturn salary;\r\n\t}\r\n\r\n\tpublic void setSalary(double salary) {\r\n\t\tthis.salary = salary;\r\n\t}\r\n\r\n}\r\n<\/code><\/pre>\n<pre class=\"post-pre\"><code>package com.Olivia.hibernate.model;\r\n\r\nimport javax.persistence.Column;\r\nimport javax.persistence.Entity;\r\nimport javax.persistence.GeneratedValue;\r\nimport javax.persistence.Id;\r\nimport javax.persistence.OneToOne;\r\nimport javax.persistence.PrimaryKeyJoinColumn;\r\nimport javax.persistence.Table;\r\n\r\nimport org.hibernate.annotations.GenericGenerator;\r\nimport org.hibernate.annotations.Parameter;\r\n\r\n@Entity\r\n@Table(name = \"ADDRESS\")\r\npublic class Address {\r\n\r\n\t@Id\r\n\t@Column(name = \"emp_id\", unique = true, nullable = false)\r\n\t@GeneratedValue(generator = \"gen\")\r\n\t@GenericGenerator(name = \"gen\", strategy = \"foreign\", \r\n\t\t\t\tparameters = { @Parameter(name = \"property\", value = \"employee\") })\r\n\tprivate long id;\r\n\r\n\t@Column(name = \"address_line1\")\r\n\tprivate String addressLine1;\r\n\r\n\t@Column(name = \"zipcode\")\r\n\tprivate String zipcode;\r\n\r\n\t@Column(name = \"city\")\r\n\tprivate String city;\r\n\r\n\t@OneToOne\r\n\t@PrimaryKeyJoinColumn\r\n\tprivate Employee employee;\r\n\r\n\tpublic long getId() {\r\n\t\treturn id;\r\n\t}\r\n\r\n\tpublic void setId(long id) {\r\n\t\tthis.id = id;\r\n\t}\r\n\r\n\tpublic String getAddressLine1() {\r\n\t\treturn addressLine1;\r\n\t}\r\n\r\n\tpublic void setAddressLine1(String addressLine1) {\r\n\t\tthis.addressLine1 = addressLine1;\r\n\t}\r\n\r\n\tpublic String getZipcode() {\r\n\t\treturn zipcode;\r\n\t}\r\n\r\n\tpublic void setZipcode(String zipcode) {\r\n\t\tthis.zipcode = zipcode;\r\n\t}\r\n\r\n\tpublic String getCity() {\r\n\t\treturn city;\r\n\t}\r\n\r\n\tpublic void setCity(String city) {\r\n\t\tthis.city = city;\r\n\t}\r\n\r\n\tpublic Employee getEmployee() {\r\n\t\treturn employee;\r\n\t}\r\n\r\n\tpublic void setEmployee(Employee employee) {\r\n\t\tthis.employee = employee;\r\n\t}\r\n\r\n}\r\n<\/code><\/pre>\n<h3>HQL\u5b9e\u4f8b\u6d4b\u8bd5\u7c7b\u7684\u793a\u4f8b<\/h3>\n<p>\u8ba9\u6211\u4eec\u6765\u770b\u770b\u5982\u4f55\u5728Java\u7a0b\u5e8f\u4e2d\u4f7f\u7528HQL\u3002<\/p>\n<pre class=\"post-pre\"><code>package com.Olivia.hibernate.main;\r\n\r\nimport java.util.Arrays;\r\nimport java.util.List;\r\n\r\nimport org.hibernate.Query;\r\nimport org.hibernate.Session;\r\nimport org.hibernate.SessionFactory;\r\nimport org.hibernate.Transaction;\r\n\r\nimport com.Olivia.hibernate.model.Employee;\r\nimport com.Olivia.hibernate.util.HibernateUtil;\r\n\r\npublic class HQLExamples {\r\n\r\n\t@SuppressWarnings(\"unchecked\")\r\n\tpublic static void main(String[] args) {\r\n\t\t\r\n\t\t\/\/Prep work\r\n\t\tSessionFactory sessionFactory = HibernateUtil.getSessionFactory();\r\n\t\tSession session = sessionFactory.getCurrentSession();\r\n\t\t\r\n\t\t\/\/HQL example - Get All Employees\r\n\t\tTransaction tx = session.beginTransaction();\r\n\t\tQuery query = session.createQuery(\"from Employee\");\r\n\t\tList&lt;Employee&gt; empList = query.list();\r\n\t\tfor(Employee emp : empList){\r\n\t\t\tSystem.out.println(\"List of Employees::\"+emp.getId()+\",\"+emp.getAddress().getCity());\r\n\t\t}\r\n\t\t\r\n\t\t\/\/HQL example - Get Employee with id\r\n\t\tquery = session.createQuery(\"from Employee where id= :id\");\r\n\t\tquery.setLong(\"id\", 3);\r\n\t\tEmployee emp = (Employee) query.uniqueResult();\r\n\t\tSystem.out.println(\"Employee Name=\"+emp.getName()+\", City=\"+emp.getAddress().getCity());\r\n\t\t\r\n\t\t\/\/HQL pagination example\r\n\t\tquery = session.createQuery(\"from Employee\");\r\n\t\tquery.setFirstResult(0); \/\/starts with 0\r\n\t\tquery.setFetchSize(2);\r\n\t\tempList = query.list();\r\n\t\tfor(Employee emp4 : empList){\r\n\t\t\tSystem.out.println(\"Paginated Employees::\"+emp4.getId()+\",\"+emp4.getAddress().getCity());\r\n\t\t}\r\n\t\t\r\n\t\t\/\/HQL Update Employee\r\n\t\tquery = session.createQuery(\"update Employee set name= :name where id= :id\");\r\n\t\tquery.setParameter(\"name\", \"Pankaj Kumar\");\r\n\t\tquery.setLong(\"id\", 1);\r\n\t\tint result = query.executeUpdate();\r\n\t\tSystem.out.println(\"Employee Update Status=\"+result);\r\n\r\n\t\t\/\/HQL Delete Employee, we need to take care of foreign key constraints too\r\n\t\tquery = session.createQuery(\"delete from Address where id= :id\");\r\n\t\tquery.setLong(\"id\", 4);\r\n\t\tresult = query.executeUpdate();\r\n\t\tSystem.out.println(\"Address Delete Status=\"+result);\r\n\t\t\r\n\t\tquery = session.createQuery(\"delete from Employee where id= :id\");\r\n\t\tquery.setLong(\"id\", 4);\r\n\t\tresult = query.executeUpdate();\r\n\t\tSystem.out.println(\"Employee Delete Status=\"+result);\r\n\t\t\r\n\t\t\/\/HQL Aggregate function examples\r\n\t\tquery = session.createQuery(\"select sum(salary) from Employee\");\r\n\t\tdouble sumSalary = (Double) query.uniqueResult();\r\n\t\tSystem.out.println(\"Sum of all Salaries= \"+sumSalary);\r\n\t\t\r\n\t\t\/\/HQL join examples\r\n\t\tquery = session.createQuery(\"select e.name, a.city from Employee e \"\r\n\t\t\t\t+ \"INNER JOIN e.address a\");\r\n\t\tList&lt;Object[]&gt; list = query.list();\r\n\t\tfor(Object[] arr : list){\r\n\t\t\tSystem.out.println(Arrays.toString(arr));\r\n\t\t}\r\n\t\t\r\n\t\t\/\/HQL group by and like example\r\n\t\tquery = session.createQuery(\"select e.name, sum(e.salary), count(e)\"\r\n\t\t\t\t+ \" from Employee e where e.name like '%i%' group by e.name\");\r\n\t\tList&lt;Object[]&gt; groupList = query.list();\r\n\t\tfor(Object[] arr : groupList){\r\n\t\t\tSystem.out.println(Arrays.toString(arr));\r\n\t\t}\r\n\t\t\r\n\t\t\/\/HQL order by example\r\n\t\tquery = session.createQuery(\"from Employee e order by e.id desc\");\r\n\t\tempList = query.list();\r\n\t\tfor(Employee emp3 : empList){\r\n\t\t\tSystem.out.println(\"ID Desc Order Employee::\"+emp3.getId()+\",\"+emp3.getAddress().getCity());\r\n\t\t}\r\n\t\t\r\n\t\t\/\/rolling back to save the test data\r\n\t\ttx.rollback();\r\n\t\t\r\n\t\t\/\/closing hibernate resources\r\n\t\tsessionFactory.close();\r\n\t}\r\n\r\n}\r\n<\/code><\/pre>\n<p>\u8bf7\u6ce8\u610f\uff0c\u6211\u5728\u4f7f\u7528HQL\u8fdb\u884c\u9009\u62e9\u3001\u66f4\u65b0\u548c\u5220\u9664\u64cd\u4f5c\u3002\u5b83\u8fd8\u5c55\u793a\u4e86\u5982\u4f55\u4f7f\u7528HQL\u8fde\u63a5\u548cHQL\u805a\u5408\u51fd\u6570\u3002\u5f53\u6211\u8fd0\u884c\u4e0a\u8ff0HQL\u793a\u4f8b\u7a0b\u5e8f\u65f6\uff0c\u6211\u4eec\u4f1a\u5f97\u5230\u4ee5\u4e0b\u8f93\u51fa\u7ed3\u679c\u3002<\/p>\n<pre class=\"post-pre\"><code>May 22, 2014 1:55:37 PM org.hibernate.annotations.common.reflection.java.JavaReflectionManager &lt;clinit&gt;\r\nINFO: HCANN000001: Hibernate Commons Annotations {4.0.4.Final}\r\nMay 22, 2014 1:55:37 PM org.hibernate.Version logVersion\r\nINFO: HHH000412: Hibernate Core {4.3.5.Final}\r\nMay 22, 2014 1:55:37 PM org.hibernate.cfg.Environment &lt;clinit&gt;\r\nINFO: HHH000206: hibernate.properties not found\r\nMay 22, 2014 1:55:37 PM org.hibernate.cfg.Environment buildBytecodeProvider\r\nINFO: HHH000021: Bytecode provider name : javassist\r\nMay 22, 2014 1:55:37 PM org.hibernate.cfg.Configuration configure\r\nINFO: HHH000043: Configuring from resource: hibernate.cfg.xml\r\nMay 22, 2014 1:55:37 PM org.hibernate.cfg.Configuration getConfigurationInputStream\r\nINFO: HHH000040: Configuration resource: hibernate.cfg.xml\r\nMay 22, 2014 1:55:37 PM org.hibernate.cfg.Configuration doConfigure\r\nINFO: HHH000041: Configured SessionFactory: null\r\nHibernate Configuration loaded\r\nHibernate serviceRegistry created\r\nMay 22, 2014 1:55:37 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure\r\nWARN: HHH000402: Using Hibernate built-in connection pool (not for production use!)\r\nMay 22, 2014 1:55:37 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator\r\nINFO: HHH000401: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql:\/\/localhost\/TestDB]\r\nMay 22, 2014 1:55:37 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator\r\nINFO: HHH000046: Connection properties: {user=pankaj, password=****}\r\nMay 22, 2014 1:55:37 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator\r\nINFO: HHH000006: Autocommit mode: false\r\nMay 22, 2014 1:55:37 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure\r\nINFO: HHH000115: Hibernate connection pool size: 20 (min=1)\r\nMay 22, 2014 1:55:37 PM org.hibernate.dialect.Dialect &lt;init&gt;\r\nINFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect\r\nMay 22, 2014 1:55:37 PM org.hibernate.engine.jdbc.internal.LobCreatorBuilder useContextualLobCreation\r\nINFO: HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4\r\nMay 22, 2014 1:55:38 PM org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService\r\nINFO: HHH000399: Using default transaction strategy (direct JDBC transactions)\r\nMay 22, 2014 1:55:38 PM org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory &lt;init&gt;\r\nINFO: HHH000397: Using ASTQueryTranslatorFactory\r\nHibernate: select employee0_.emp_id as emp_id1_1_, employee0_.emp_name as emp_name2_1_, employee0_.emp_salary as emp_sala3_1_ from EMPLOYEE employee0_\r\nHibernate: select address0_.emp_id as emp_id1_0_0_, address0_.address_line1 as address_2_0_0_, address0_.city as city3_0_0_, address0_.zipcode as zipcode4_0_0_, employee1_.emp_id as emp_id1_1_1_, employee1_.emp_name as emp_name2_1_1_, employee1_.emp_salary as emp_sala3_1_1_ from ADDRESS address0_ left outer join EMPLOYEE employee1_ on address0_.emp_id=employee1_.emp_id where address0_.emp_id=?\r\nHibernate: select address0_.emp_id as emp_id1_0_0_, address0_.address_line1 as address_2_0_0_, address0_.city as city3_0_0_, address0_.zipcode as zipcode4_0_0_, employee1_.emp_id as emp_id1_1_1_, employee1_.emp_name as emp_name2_1_1_, employee1_.emp_salary as emp_sala3_1_1_ from ADDRESS address0_ left outer join EMPLOYEE employee1_ on address0_.emp_id=employee1_.emp_id where address0_.emp_id=?\r\nHibernate: select address0_.emp_id as emp_id1_0_0_, address0_.address_line1 as address_2_0_0_, address0_.city as city3_0_0_, address0_.zipcode as zipcode4_0_0_, employee1_.emp_id as emp_id1_1_1_, employee1_.emp_name as emp_name2_1_1_, employee1_.emp_salary as emp_sala3_1_1_ from ADDRESS address0_ left outer join EMPLOYEE employee1_ on address0_.emp_id=employee1_.emp_id where address0_.emp_id=?\r\nHibernate: select address0_.emp_id as emp_id1_0_0_, address0_.address_line1 as address_2_0_0_, address0_.city as city3_0_0_, address0_.zipcode as zipcode4_0_0_, employee1_.emp_id as emp_id1_1_1_, employee1_.emp_name as emp_name2_1_1_, employee1_.emp_salary as emp_sala3_1_1_ from ADDRESS address0_ left outer join EMPLOYEE employee1_ on address0_.emp_id=employee1_.emp_id where address0_.emp_id=?\r\nList of Employees::1,San Jose\r\nList of Employees::2,Santa Clara\r\nList of Employees::3,Bangalore\r\nList of Employees::4,New Delhi\r\nHibernate: select employee0_.emp_id as emp_id1_1_, employee0_.emp_name as emp_name2_1_, employee0_.emp_salary as emp_sala3_1_ from EMPLOYEE employee0_ where employee0_.emp_id=?\r\nEmployee Name=Lisa, City=Bangalore\r\nHibernate: select employee0_.emp_id as emp_id1_1_, employee0_.emp_name as emp_name2_1_, employee0_.emp_salary as emp_sala3_1_ from EMPLOYEE employee0_\r\nPaginated Employees::1,San Jose\r\nPaginated Employees::2,Santa Clara\r\nPaginated Employees::3,Bangalore\r\nPaginated Employees::4,New Delhi\r\nHibernate: update EMPLOYEE set emp_name=? where emp_id=?\r\nEmployee Update Status=1\r\nHibernate: delete from ADDRESS where emp_id=?\r\nAddress Delete Status=1\r\nHibernate: delete from EMPLOYEE where emp_id=?\r\nEmployee Delete Status=1\r\nHibernate: select sum(employee0_.emp_salary) as col_0_0_ from EMPLOYEE employee0_\r\nSum of all Salaries= 600.0\r\nHibernate: select employee0_.emp_name as col_0_0_, address1_.city as col_1_0_ from EMPLOYEE employee0_ inner join ADDRESS address1_ on employee0_.emp_id=address1_.emp_id\r\n[Pankaj Kumar, San Jose]\r\n[David, Santa Clara]\r\n[Lisa, Bangalore]\r\nHibernate: select employee0_.emp_name as col_0_0_, sum(employee0_.emp_salary) as col_1_0_, count(employee0_.emp_id) as col_2_0_ from EMPLOYEE employee0_ where employee0_.emp_name like '%i%' group by employee0_.emp_name\r\n[David, 200.0, 1]\r\n[Lisa, 300.0, 1]\r\nHibernate: select employee0_.emp_id as emp_id1_1_, employee0_.emp_name as emp_name2_1_, employee0_.emp_salary as emp_sala3_1_ from EMPLOYEE employee0_ order by employee0_.emp_id desc\r\nID Desc Order Employee::3,Bangalore\r\nID Desc Order Employee::2,Santa Clara\r\nID Desc Order Employee::1,San Jose\r\nMay 22, 2014 1:55:38 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl stop\r\nINFO: HHH000030: Cleaning up connection pool [jdbc:mysql:\/\/localhost\/TestDB]\r\n<\/code><\/pre>\n<p>\u8bf7\u6ce8\u610f\uff0c\u4e00\u65e6\u6267\u884c\u5220\u9664\u64cd\u4f5c\uff0c\u540e\u7eed\u64cd\u4f5c\u5c06\u4e0d\u4f1a\u663e\u793a\u8be5\u8bb0\u5f55\u7684\u6570\u636e\uff08\u5de5\u8d44\u603b\u989d\u4e3a600\uff09\u3002\u7136\u800c\uff0c\u6211\u6b63\u5728\u56de\u6eda\u4e8b\u52a1\uff0c\u6240\u4ee5\u8868\u4e2d\u7684\u6570\u636e\u5c06\u4fdd\u6301\u4e0d\u53d8\u3002\u4fee\u6539\u4ee3\u7801\u4ee5\u63d0\u4ea4\u4e8b\u52a1\uff0c\u5e76\u5c06\u5176\u53cd\u6620\u5728\u6570\u636e\u5e93\u8868\u4e2d\u3002\u6211\u4e0d\u559c\u6b22\u7ecf\u5e38\u4f7f\u7528HQL\u67e5\u8be2\uff0c\u56e0\u4e3a\u5982\u60a8\u6240\u89c1\uff0c\u6211\u4eec\u9700\u8981\u5728\u4ee3\u7801\u4e2d\u5904\u7406\u8868\u6620\u5c04\u3002\u5982\u679c\u6211\u4eec\u4f7f\u7528Session\u6765\u5220\u9664Employee\u5bf9\u8c61\uff0c\u5b83\u5c06\u4ece\u4e24\u4e2a\u8868\u4e2d\u5220\u9664\u8bb0\u5f55\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>HQL\u6216Hibernate\u67e5\u8be2\u8bed\u8a00\u662fHibernate\u6846\u67b6\u7684\u9762\u5411\u5bf9\u8c61\u67e5\u8be2\u8bed\u8a00\u3002HQL\u4e0eSQL\u975e\u5e38\u76f8\u4f3c\uff0c\u53ea\u662f\u6211\u4eec [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-50723","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>HQL - Hibernate\u67e5\u8be2\u8bed\u8a00 - \u793a\u4f8b\u6559\u7a0b - Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/hql-hibernate\u67e5\u8be2\u8bed\u8a00-\u793a\u4f8b\u6559\u7a0b\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"HQL - Hibernate\u67e5\u8be2\u8bed\u8a00 - \u793a\u4f8b\u6559\u7a0b\" \/>\n<meta property=\"og:description\" content=\"HQL\u6216Hibernate\u67e5\u8be2\u8bed\u8a00\u662fHibernate\u6846\u67b6\u7684\u9762\u5411\u5bf9\u8c61\u67e5\u8be2\u8bed\u8a00\u3002HQL\u4e0eSQL\u975e\u5e38\u76f8\u4f3c\uff0c\u53ea\u662f\u6211\u4eec [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/hql-hibernate\u67e5\u8be2\u8bed\u8a00-\u793a\u4f8b\u6559\u7a0b\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-12-23T02:31:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-23T07:35:49+00:00\" \/>\n<meta name=\"author\" content=\"\u96c5, \u609f\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u96c5, \u609f\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/hql-hibernate%e6%9f%a5%e8%af%a2%e8%af%ad%e8%a8%80-%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/hql-hibernate%e6%9f%a5%e8%af%a2%e8%af%ad%e8%a8%80-%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/\",\"name\":\"HQL - Hibernate\u67e5\u8be2\u8bed\u8a00 - \u793a\u4f8b\u6559\u7a0b - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-12-23T02:31:39+00:00\",\"dateModified\":\"2023-12-23T07:35:49+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/hql-hibernate%e6%9f%a5%e8%af%a2%e8%af%ad%e8%a8%80-%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/hql-hibernate%e6%9f%a5%e8%af%a2%e8%af%ad%e8%a8%80-%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/hql-hibernate%e6%9f%a5%e8%af%a2%e8%af%ad%e8%a8%80-%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"HQL &#8211; Hibernate\u67e5\u8be2\u8bed\u8a00 &#8211; \u793a\u4f8b\u6559\u7a0b\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6\",\"name\":\"\u96c5, \u609f\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g\",\"caption\":\"\u96c5, \u609f\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/yawu\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/hql-hibernate%e6%9f%a5%e8%af%a2%e8%af%ad%e8%a8%80-%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"HQL - Hibernate\u67e5\u8be2\u8bed\u8a00 - \u793a\u4f8b\u6559\u7a0b - Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/hql-hibernate\u67e5\u8be2\u8bed\u8a00-\u793a\u4f8b\u6559\u7a0b\/","og_locale":"zh_CN","og_type":"article","og_title":"HQL - Hibernate\u67e5\u8be2\u8bed\u8a00 - \u793a\u4f8b\u6559\u7a0b","og_description":"HQL\u6216Hibernate\u67e5\u8be2\u8bed\u8a00\u662fHibernate\u6846\u67b6\u7684\u9762\u5411\u5bf9\u8c61\u67e5\u8be2\u8bed\u8a00\u3002HQL\u4e0eSQL\u975e\u5e38\u76f8\u4f3c\uff0c\u53ea\u662f\u6211\u4eec [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/hql-hibernate\u67e5\u8be2\u8bed\u8a00-\u793a\u4f8b\u6559\u7a0b\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-12-23T02:31:39+00:00","article_modified_time":"2023-12-23T07:35:49+00:00","author":"\u96c5, \u609f","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u96c5, \u609f","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/hql-hibernate%e6%9f%a5%e8%af%a2%e8%af%ad%e8%a8%80-%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/hql-hibernate%e6%9f%a5%e8%af%a2%e8%af%ad%e8%a8%80-%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/","name":"HQL - Hibernate\u67e5\u8be2\u8bed\u8a00 - \u793a\u4f8b\u6559\u7a0b - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-12-23T02:31:39+00:00","dateModified":"2023-12-23T07:35:49+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/hql-hibernate%e6%9f%a5%e8%af%a2%e8%af%ad%e8%a8%80-%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/hql-hibernate%e6%9f%a5%e8%af%a2%e8%af%ad%e8%a8%80-%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/hql-hibernate%e6%9f%a5%e8%af%a2%e8%af%ad%e8%a8%80-%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"HQL &#8211; Hibernate\u67e5\u8be2\u8bed\u8a00 &#8211; \u793a\u4f8b\u6559\u7a0b"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6","name":"\u96c5, \u609f","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g","caption":"\u96c5, \u609f"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/yawu\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/hql-hibernate%e6%9f%a5%e8%af%a2%e8%af%ad%e8%a8%80-%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/50723","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=50723"}],"version-history":[{"count":1,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/50723\/revisions"}],"predecessor-version":[{"id":50808,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/50723\/revisions\/50808"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=50723"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=50723"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=50723"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}