{"id":663,"date":"2023-08-31T19:43:55","date_gmt":"2023-07-13T06:05:59","guid":{"rendered":"https:\/\/www.silicloud.com\/ja\/blog\/index.php\/2023\/11\/30\/hql%ef%bc%88hibernate-query-language%ef%bc%89%e3%81%ae%e4%be%8b%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%81%ae%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab\/"},"modified":"2025-08-01T01:28:29","modified_gmt":"2025-07-31T16:28:29","slug":"hql%ef%bc%88hibernate-query-language%ef%bc%89%e3%81%ae%e4%be%8b%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%81%ae%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/ja\/blog\/hql%ef%bc%88hibernate-query-language%ef%bc%89%e3%81%ae%e4%be%8b%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%81%ae%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab\/","title":{"rendered":"HQL\uff08Hibernate Query Language\uff09\u306e\u4f8b\u306b\u3064\u3044\u3066\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb"},"content":{"rendered":"<p>HQL\u307e\u305f\u306fHibernate\u30af\u30a8\u30ea\u8a00\u8a9e\u306f\u3001Hibernate\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411\u30af\u30a8\u30ea\u8a00\u8a9e\u3067\u3059\u3002HQL\u306f\u3001\u30c6\u30fc\u30d6\u30eb\u540d\u306e\u4ee3\u308f\u308a\u306b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f7f\u7528\u3059\u308b\u70b9\u3092\u9664\u3044\u3066\u3001SQL\u306b\u975e\u5e38\u306b\u4f3c\u3066\u3044\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306b\u3088\u308a\u8fd1\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>\u30cf\u30a4\u30d0\u30cd\u30fc\u30c8\u30af\u30a8\u30ea\u8a00\u8a9e\uff08HQL\uff09<\/h2>\n<p>HQL\u3068\u5927\u6587\u5b57\u3068\u5c0f\u6587\u5b57\u306e\u533a\u5225\uff1aHQL\u306fjava\u306e\u30af\u30e9\u30b9\u3084\u5909\u6570\u540d\u3092\u9664\u3044\u3066\u5927\u6587\u5b57\u3068\u5c0f\u6587\u5b57\u3092\u533a\u5225\u3057\u306a\u3044\u3067\u3059\u3002\u3057\u305f\u304c\u3063\u3066\u3001SeLeCT\u306fsELEct\u3068\u540c\u3058\u3067\u3042\u308a\u3001SELECT\u3068\u3082\u540c\u3058\u3067\u3059\u304c\u3001com.scdev.model.Employee\u306fcom.scdev.model.EMPLOYEE\u3068\u306f\u7570\u306a\u308a\u307e\u3059\u3002HQL\u3067\u4e00\u822c\u7684\u306b\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u308b\u3044\u304f\u3064\u304b\u306e\u7bc0\u306f\u6b21\u306e\u3068\u304a\u308a\u3067\u3059\u3002<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>HQL\u306eFrom\u53e5\uff1aHQL\u306eFrom\u53e5\u306f\u3001SQL\u306eselect\u53e5\u3068\u540c\u3058\u3067\u3059\u3002\u4f8b\u3048\u3070\u3001from Employee\u306f\u3001select * from Employee\u3068\u540c\u3058\u610f\u5473\u3067\u3059\u3002\u307e\u305f\u3001from Employee emp\u3084from Employee as emp\u306e\u3088\u3046\u306b\u30a8\u30a4\u30ea\u30a2\u30b9\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>HQL\u306eJoin\uff1aHQL\u306f\u5185\u90e8\u7d50\u5408\u3001\u5de6\u5916\u90e8\u7d50\u5408\u3001\u53f3\u5916\u90e8\u7d50\u5408\u3001\u30d5\u30eb\u7d50\u5408\u3092\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001select e.name, a.city from Employee e INNER JOIN e.address a\u3068\u3044\u3046\u30af\u30a8\u30ea\u3067\u306f\u3001Employee\u30af\u30e9\u30b9\u306baddress\u3068\u3044\u3046\u5909\u6570\u304c\u5b58\u5728\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u5177\u4f53\u7684\u306a\u30b3\u30fc\u30c9\u306e\u4f8b\u3067\u8aac\u660e\u3057\u307e\u3059\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u96c6\u8a08\u95a2\u6570\uff1aHQL\u306f\u3001count(*)\u3001count(distinct x)\u3001min()\u3001max()\u3001avg()\u3001sum()\u3068\u3044\u3063\u305f\u4e00\u822c\u7684\u306b\u4f7f\u7528\u3055\u308c\u308b\u96c6\u8a08\u95a2\u6570\u3092\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u307e\u3059\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u5f0f\uff1aHQL\u306f\u7b97\u8853\u6f14\u7b97\u5b50\uff08+\u3001-\u3001*\u3001\/\uff09\u3001\u30d0\u30a4\u30ca\u30ea\u6bd4\u8f03\u6f14\u7b97\u5b50\uff08=\u3001&gt;=\u3001&lt;=\u3001&lt;&gt;, !=\u3001like\uff09\u3001\u8ad6\u7406\u6f14\u7b97\uff08and\u3001or\u3001not\uff09\u306a\u3069\u306e\u5f0f\u3092\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u307e\u3059\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>HQL\u306f\u307e\u305f\u3001order by\u53e5\u3084group by\u53e5\u3082\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u307e\u3059\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>HQL\u306fSQL\u30af\u30a8\u30ea\u3068\u540c\u69d8\u306b\u3001\u30b5\u30d6\u30af\u30a8\u30ea\u3082\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u307e\u3059\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>HQL\u306fDDL\u3001DML\u3001\u30b9\u30c8\u30a2\u30d7\u30ed\u30b7\u30fc\u30b8\u30e3\u306e\u5b9f\u884c\u3082\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u307e\u3059\u3002<\/ol>\n<p>\u30d7\u30ed\u30b0\u30e9\u30e0\u5185\u3067HQL\u3092\u4f7f\u7528\u3057\u305f\u7c21\u5358\u306a\u4f8b\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<h3>HQL\u306e\u30b5\u30f3\u30d7\u30eb\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u8a2d\u5b9a\u306e\u4f8b<\/h3>\n<p>\u4f8b\u3068\u3057\u3066MySQL\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4f7f\u7528\u3057\u3066\u304a\u308a\u3001\u4e0b\u8a18\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u306fEmployee\u3068Address\u306e2\u3064\u306e\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u3053\u308c\u3089\u306f\u4e00\u5bfe\u4e00\u306e\u95a2\u9023\u6027\u3092\u6301\u3063\u3066\u304a\u308a\u3001\u4f8b\u3092\u793a\u3059\u305f\u3081\u306b\u3044\u304f\u3064\u304b\u306e\u30c7\u30e2\u30c7\u30fc\u30bf\u3092\u633f\u5165\u3057\u3066\u3044\u307e\u3059\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>Eclipse\u307e\u305f\u306f\u3054\u4f7f\u7528\u306eIDE\u3067Maven\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u3001\u6700\u7d42\u7684\u306a\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306f\u4ee5\u4e0b\u306e\u753b\u50cf\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>\u30cf\u30a4\u30d0\u30cd\u30fc\u30c8\u306eMaven\u4f9d\u5b58\u95a2\u4fc2<\/h3>\n<p>\u6700\u7d42\u7684\u306apom.xml\u306b\u306f\u3001Hibernate\u3068MySQL\u30c9\u30e9\u30a4\u30d0\u30fc\u306e\u4f9d\u5b58\u95a2\u4fc2\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\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.scdev.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>\u30cd\u30a4\u30c6\u30a3\u30d6\u306a\u65e5\u672c\u8a9e\u306b\u4ee5\u4e0b\u306e\u5185\u5bb9\u3092\u8a00\u3044\u63db\u3048\u307e\u3059\uff08\u30aa\u30d7\u30b7\u30e7\u30f3\u306f\u4e00\u3064\u306e\u307f\uff09\uff1a<br \/>\n\u30cf\u30a4\u30d0\u30cd\u30fc\u30c8\u306e\u8a2d\u5b9aXML<\/h3>\n<p>\u79c1\u305f\u3061\u306eHibernate\u306e\u8a2d\u5b9aXML\u30d5\u30a1\u30a4\u30eb\u306b\u306f\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u63a5\u7d9a\u306b\u95a2\u9023\u3059\u308b\u30d7\u30ed\u30d1\u30c6\u30a3\u3084\u30de\u30c3\u30d4\u30f3\u30b0\u30af\u30e9\u30b9\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u3002\u79c1\u306fHibernate\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u305f\u3081\u306b\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u3092\u4f7f\u7528\u3059\u308b\u4e88\u5b9a\u3067\u3059\u3002hibernate.cfg.xml\u306e\u30b3\u30fc\u30c9\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/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;scdev123&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;scdev&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.scdev.hibernate.model.Employee\"\/&gt;\r\n        &lt;mapping class=\"com.scdev.hibernate.model.Address\"\/&gt;\r\n    &lt;\/session-factory&gt;\r\n&lt;\/hibernate-configuration&gt;\r\n<\/code><\/pre>\n<h3>\u30d2\u30d9\u30eb\u30cd\u30fc\u30c8\u306eSessionFactory\u306e\u30e6\u30fc\u30c6\u30a3\u30ea\u30c6\u30a3\u30af\u30e9\u30b9<\/h3>\n<p>\u79c1\u305f\u3061\u306f\u3001Hibernate SessionFactory\u3092\u8a2d\u5b9a\u3059\u308b\u305f\u3081\u306e\u30e6\u30fc\u30c6\u30a3\u30ea\u30c6\u30a3\u30af\u30e9\u30b9\u3092\u6301\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>package com.scdev.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>\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u3092\u4f7f\u7528\u3057\u305f\u30de\u30c3\u30d4\u30f3\u30b0\u3092\u6301\u3064\u30e2\u30c7\u30eb\u30af\u30e9\u30b9<\/h3>\n<p>\u79c1\u305f\u3061\u306eJPA \u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u3092\u4f7f\u7528\u3057\u305f\u30e2\u30c7\u30eb\u30af\u30e9\u30b9\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>package com.scdev.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.scdev.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\u306e\u4f8b\u306e\u30c6\u30b9\u30c8\u30af\u30e9\u30b9<\/h3>\n<p>Java\u30d7\u30ed\u30b0\u30e9\u30e0\u3067HQL\u3092\u4f7f\u3046\u65b9\u6cd5\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"post-pre\"><code>package com.scdev.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.scdev.hibernate.model.Employee;\r\nimport com.scdev.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>HQL\u306eSelect\u3001Update\u3001Delete\u64cd\u4f5c\u3092\u4f7f\u7528\u3057\u3066\u3044\u308b\u3053\u3068\u306b\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u307e\u305f\u3001HQL\u306eJoin\u3068HQL\u306e\u96c6\u8a08\u95a2\u6570\u306e\u4f7f\u3044\u65b9\u3082\u793a\u3057\u3066\u3044\u307e\u3059\u3002\u4e0a\u8a18\u306eHQL\u306e\u4f8b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u51fa\u529b\u304c\u5f97\u3089\u308c\u307e\u3059\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=scdev, 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>\u524a\u9664\u64cd\u4f5c\u304c\u884c\u308f\u308c\u308b\u3068\u3001\u305d\u306e\u30ec\u30b3\u30fc\u30c9\u30c7\u30fc\u30bf\uff08\u7d66\u4e0e\u306e\u5408\u8a08\u306f600\u3067\u3059\uff09\u304c\u8868\u793a\u3055\u308c\u306a\u304f\u306a\u308b\u3053\u3068\u306b\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3057\u304b\u3057\u3001\u79c1\u306f\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u3092\u30ed\u30fc\u30eb\u30d0\u30c3\u30af\u3057\u3066\u3044\u308b\u305f\u3081\u3001\u30c6\u30fc\u30d6\u30eb\u5185\u306e\u30c7\u30fc\u30bf\u306f\u5909\u66f4\u3055\u308c\u307e\u305b\u3093\u3002\u30b3\u30fc\u30c9\u3092\u5909\u66f4\u3057\u3066\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u3092\u30b3\u30df\u30c3\u30c8\u3059\u308b\u3068\u3001\u305d\u308c\u304c\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30c6\u30fc\u30d6\u30eb\u306b\u53cd\u6620\u3055\u308c\u307e\u3059\u3002\u79c1\u306fHQL\u30af\u30a8\u30ea\u3092\u591a\u7528\u3059\u308b\u306e\u306f\u597d\u304d\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u306a\u305c\u306a\u3089\u3001\u30b3\u30fc\u30c9\u5185\u3067\u30c6\u30fc\u30d6\u30eb\u306e\u30de\u30c3\u30d4\u30f3\u30b0\u306b\u6c17\u3092\u4ed8\u3051\u308b\u5fc5\u8981\u304c\u3042\u308b\u304b\u3089\u3067\u3059\u3002Employee\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u524a\u9664\u3059\u308b\u305f\u3081\u306bSession\u3092\u4f7f\u7528\u3059\u308b\u3068\u30012\u3064\u306e\u30c6\u30fc\u30d6\u30eb\u304b\u3089\u30ec\u30b3\u30fc\u30c9\u304c\u524a\u9664\u3055\u308c\u307e\u3059\u3002\u4ee5\u4e0b\u306e\u30ea\u30f3\u30af\u304b\u3089\u30b5\u30f3\u30d7\u30ebHQL\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u3001\u3055\u3089\u306b\u4f8b\u3092\u8a66\u3057\u3066\u307f\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u30d2\u30d9\u30eb\u30cd\u30a4\u30c8HQL\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>HQL\u307e\u305f\u306fHibernate\u30af\u30a8\u30ea\u8a00\u8a9e\u306f\u3001Hibernate\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411\u30af\u30a8\u30ea\u8a00\u8a9e\u3067\u3059\u3002HQL\u306f\u3001\u30c6\u30fc\u30d6\u30eb\u540d\u306e\u4ee3\u308f\u308a\u306b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f7f\u7528\u3059\u308b\u70b9\u3092\u9664\u3044\u3066\u3001SQL\u306b\u975e\u5e38\u306b\u4f3c\u3066\u3044\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30aa\u30d6\u30b8\u30a7 [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[26,61],"class_list":["post-663","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-26","tag-61"],"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\uff08Hibernate Query Language\uff09\u306e\u4f8b\u306b\u3064\u3044\u3066\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"HQL\uff08Hibernate Query Language\uff09\u306e\u4f8b\u306b\u3064\u3044\u3066\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002\" \/>\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\/ja\/blog\/hql\uff08hibernate-query-language\uff09\u306e\u4f8b\u306b\u3064\u3044\u3066\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\/\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"HQL\uff08Hibernate Query Language\uff09\u306e\u4f8b\u306b\u3064\u3044\u3066\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\" \/>\n<meta property=\"og:description\" content=\"HQL\uff08Hibernate Query Language\uff09\u306e\u4f8b\u306b\u3064\u3044\u3066\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/ja\/blog\/hql\uff08hibernate-query-language\uff09\u306e\u4f8b\u306b\u3064\u3044\u3066\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-13T06:05:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-07-31T16:28:29+00:00\" \/>\n<meta name=\"author\" content=\"\u84ee, \u7ffc\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u57f7\u7b46\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u84ee, \u7ffc\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"41\u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/hql%ef%bc%88hibernate-query-language%ef%bc%89%e3%81%ae%e4%be%8b%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%81%ae%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab\/\",\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/hql%ef%bc%88hibernate-query-language%ef%bc%89%e3%81%ae%e4%be%8b%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%81%ae%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab\/\",\"name\":\"HQL\uff08Hibernate Query Language\uff09\u306e\u4f8b\u306b\u3064\u3044\u3066\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#website\"},\"datePublished\":\"2023-07-13T06:05:59+00:00\",\"dateModified\":\"2025-07-31T16:28:29+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/cdc124a0aaebf26393d8d591183ca413\"},\"description\":\"HQL\uff08Hibernate Query Language\uff09\u306e\u4f8b\u306b\u3064\u3044\u3066\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/hql%ef%bc%88hibernate-query-language%ef%bc%89%e3%81%ae%e4%be%8b%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%81%ae%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab\/#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/ja\/blog\/hql%ef%bc%88hibernate-query-language%ef%bc%89%e3%81%ae%e4%be%8b%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%81%ae%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/hql%ef%bc%88hibernate-query-language%ef%bc%89%e3%81%ae%e4%be%8b%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%81%ae%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/ja\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"HQL\uff08Hibernate Query Language\uff09\u306e\u4f8b\u306b\u3064\u3044\u3066\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"ja\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/cdc124a0aaebf26393d8d591183ca413\",\"name\":\"\u84ee, \u7ffc\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/27308f733c7fcdac8617926a0100c77213339c4e501310a08c0baf946bf823bc?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/27308f733c7fcdac8617926a0100c77213339c4e501310a08c0baf946bf823bc?s=96&d=mm&r=g\",\"caption\":\"\u84ee, \u7ffc\"},\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/author\/rentsubasa\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/hql%ef%bc%88hibernate-query-language%ef%bc%89%e3%81%ae%e4%be%8b%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%81%ae%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"HQL\uff08Hibernate Query Language\uff09\u306e\u4f8b\u306b\u3064\u3044\u3066\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb - Blog - Silicon Cloud","description":"HQL\uff08Hibernate Query Language\uff09\u306e\u4f8b\u306b\u3064\u3044\u3066\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002","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\/ja\/blog\/hql\uff08hibernate-query-language\uff09\u306e\u4f8b\u306b\u3064\u3044\u3066\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\/","og_locale":"ja_JP","og_type":"article","og_title":"HQL\uff08Hibernate Query Language\uff09\u306e\u4f8b\u306b\u3064\u3044\u3066\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb","og_description":"HQL\uff08Hibernate Query Language\uff09\u306e\u4f8b\u306b\u3064\u3044\u3066\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002","og_url":"https:\/\/www.silicloud.com\/ja\/blog\/hql\uff08hibernate-query-language\uff09\u306e\u4f8b\u306b\u3064\u3044\u3066\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-07-13T06:05:59+00:00","article_modified_time":"2025-07-31T16:28:29+00:00","author":"\u84ee, \u7ffc","twitter_card":"summary_large_image","twitter_misc":{"\u57f7\u7b46\u8005":"\u84ee, \u7ffc","\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593":"41\u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/ja\/blog\/hql%ef%bc%88hibernate-query-language%ef%bc%89%e3%81%ae%e4%be%8b%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%81%ae%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab\/","url":"https:\/\/www.silicloud.com\/ja\/blog\/hql%ef%bc%88hibernate-query-language%ef%bc%89%e3%81%ae%e4%be%8b%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%81%ae%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab\/","name":"HQL\uff08Hibernate Query Language\uff09\u306e\u4f8b\u306b\u3064\u3044\u3066\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#website"},"datePublished":"2023-07-13T06:05:59+00:00","dateModified":"2025-07-31T16:28:29+00:00","author":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/cdc124a0aaebf26393d8d591183ca413"},"description":"HQL\uff08Hibernate Query Language\uff09\u306e\u4f8b\u306b\u3064\u3044\u3066\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/hql%ef%bc%88hibernate-query-language%ef%bc%89%e3%81%ae%e4%be%8b%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%81%ae%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab\/#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/ja\/blog\/hql%ef%bc%88hibernate-query-language%ef%bc%89%e3%81%ae%e4%be%8b%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%81%ae%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/ja\/blog\/hql%ef%bc%88hibernate-query-language%ef%bc%89%e3%81%ae%e4%be%8b%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%81%ae%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/ja\/blog\/"},{"@type":"ListItem","position":2,"name":"HQL\uff08Hibernate Query Language\uff09\u306e\u4f8b\u306b\u3064\u3044\u3066\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#website","url":"https:\/\/www.silicloud.com\/ja\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"ja"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/cdc124a0aaebf26393d8d591183ca413","name":"\u84ee, \u7ffc","image":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/27308f733c7fcdac8617926a0100c77213339c4e501310a08c0baf946bf823bc?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/27308f733c7fcdac8617926a0100c77213339c4e501310a08c0baf946bf823bc?s=96&d=mm&r=g","caption":"\u84ee, \u7ffc"},"url":"https:\/\/www.silicloud.com\/ja\/blog\/author\/rentsubasa\/"},{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/hql%ef%bc%88hibernate-query-language%ef%bc%89%e3%81%ae%e4%be%8b%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e3%81%ae%e3%83%81%e3%83%a5%e3%83%bc%e3%83%88%e3%83%aa%e3%82%a2%e3%83%ab\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/663","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/comments?post=663"}],"version-history":[{"count":1,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/663\/revisions"}],"predecessor-version":[{"id":43444,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/663\/revisions\/43444"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/media?parent=663"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/categories?post=663"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/tags?post=663"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}