{"id":683,"date":"2022-08-23T07:37:22","date_gmt":"2022-11-18T23:27:24","guid":{"rendered":"https:\/\/www.silicloud.com\/ja\/blog\/index.php\/2023\/11\/30\/jpa%e3%81%ae%e3%82%a8%e3%83%b3%e3%83%86%e3%82%a3%e3%83%86%e3%82%a3%e3%83%9e%e3%83%8d%e3%83%bc%e3%82%b8%e3%83%a3%e3%83%bc%e3%81%a8hibernate%e3%81%ae%e3%82%a8%e3%83%b3%e3%83%86%e3%82%a3%e3%83%86\/"},"modified":"2025-08-01T01:38:04","modified_gmt":"2025-07-31T16:38:04","slug":"jpa%e3%81%ae%e3%82%a8%e3%83%b3%e3%83%86%e3%82%a3%e3%83%86%e3%82%a3%e3%83%9e%e3%83%8d%e3%83%bc%e3%82%b8%e3%83%a3%e3%83%bc%e3%81%a8hibernate%e3%81%ae%e3%82%a8%e3%83%b3%e3%83%86%e3%82%a3%e3%83%86","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/ja\/blog\/jpa%e3%81%ae%e3%82%a8%e3%83%b3%e3%83%86%e3%82%a3%e3%83%86%e3%82%a3%e3%83%9e%e3%83%8d%e3%83%bc%e3%82%b8%e3%83%a3%e3%83%bc%e3%81%a8hibernate%e3%81%ae%e3%82%a8%e3%83%b3%e3%83%86%e3%82%a3%e3%83%86\/","title":{"rendered":"JPA\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u3068Hibernate\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc"},"content":{"rendered":"<p>JPA EntityManager\u306f\u3001Java Persistence API\u306e\u4e2d\u5fc3\u306b\u4f4d\u7f6e\u3057\u3066\u3044\u307e\u3059\u3002Hibernate\u306f\u3001\u6700\u3082\u5e83\u304f\u4f7f\u308f\u308c\u3066\u3044\u308bJPA\u306e\u5b9f\u88c5\u3067\u3059\u3002<\/p>\n<h2>JPA\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3<\/h2>\n<ul class=\"post-ul\">\n<li>One of the most important aspect of a program is connection with database. Database connection and transaction with database is considered as most expensive transaction. ORM is a very important tool in this regard. ORM helps in representing relations of database in terms of java objects.<\/li>\n<li>ORM consists of two concepts object-oriented and relational programming.<\/li>\n<li>Hibernate is an ORM framework where programmer describes the way objects are represented in database. Hibernate handles the conversion automatically.<\/li>\n<li>Hibernate provides implementation of JPA interfaces EntityManagerFactory and EntityManager.<\/li>\n<li>EntityManagerFactory provides instances of EntityManager for connecting to same database. All the instances are configured to use the same setting as defined by the default implementation. Several entity manager factories can be prepared for connecting to different data stores.<\/li>\n<li>JPA EntityManager is used to access a database in a particular application. It is used to manage persistent entity instances, to find entities by their primary key identity, and to query over all entities.<\/li>\n<\/ul>\n<h3>JPA\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u30e1\u30bd\u30c3\u30c9\u3092\u65e5\u672c\u8a9e\u3067\u4e00\u3064\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u8a00\u3044\u63db\u3048\u3066\u304f\u3060\u3055\u3044\u3002<\/h3>\n<p>JPA EntityManager\u306f\u3001\u4ee5\u4e0b\u306e\u4e00\u9023\u306e\u30e1\u30bd\u30c3\u30c9\u3067\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u8aad\u307f\u3084\u3059\u3055\u306e\u305f\u3081\u306b\u3001\u30e1\u30bd\u30c3\u30c9\u306e\u5f15\u6570\u306f\u7701\u7565\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>persist &#8211; Make an instance managed and persistent.<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>merge &#8211; Merge the state of the given entity into the current persistence context.<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>remove &#8211; Remove the entity instance.<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>find &#8211; Find by primary key. Search for an entity of the specified class and primary key. If the entity instance is contained in the persistence context, it is returned from there.<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>getReference \u2013 returns and instance which is lazily fetched and will throw EntityNotFoundException when the instance is accessed for the first time.<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>flush \u2013 Synchronizes the persistence context with the database.<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>setFlushMode \u2013 set the flush mode for all the objects of the persistence context.<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>getFlushMode \u2013 get the flush mode for all the objects of the persistence context.<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>lock &#8211; Lock an entity instance that is contained in the persistence context with the specified lock mode type.<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>refresh \u2013 it refreshes the state of the instance from the database also it will overwrite the changes to the entity.<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>clear &#8211; Clear the persistence context, causing all managed entities to become detached. Changes made to entities that have not been flushed to the database will not be persisted.<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>detach \u2013 this is similar to the clear method, only addition is the entity which previously referenced the detached object will continue to do so.<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>contains \u2013 it checks if the managed entity belongs to the current persistence context.<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>getLockMode \u2013 get the current lock mode for entity instance.<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>setProperty \u2013 set an entity manager property or hint.<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>getProperties \u2013 get the properties and hints associated with the entity manager.<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>createQuery &#8211; Create an instance of Query for executing a Java Persistence query language statement.<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>createNamedQuery &#8211; Create an instance of Query for executing a Java Persistence named query language statement.<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>createNativeQuery &#8211; Create an instance of Query for executing a native sql statement.<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>createNamedStoredProcedureQuery &#8211; Create an instance of StoredProcedureQuery for executing a stored procedure in the database.<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>createStoredProcedureQuery &#8211; Create an instance of StoredProcedureQuery for executing a stored procedure in the database.<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>joinTransaction &#8211; Indicate to the entity manager that a JTA transaction is active. This method should be called on a JTA application managed entity manager that was created outside the scope of the active transaction to associate it with the current JTA transaction.<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>isJoinedToTransaction \u2013 it determines if the entityManager is linked to the current transaction.<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>unwrap &#8211; Return an object of the specified type to allow access to the provider-specific API<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>getDelegate \u2013 return the provider object for the entityManager.<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>close \u2013 close an application-managed entityManager.<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>isOpen \u2013 determine if the entityManager is open.<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>getTransaction &#8211; Return the resource-level EntityTransaction object.<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>getEntityManagerFactory \u2013 provides the entity manager factory for the entity manager.<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>getCriteriaBuilder &#8211; Return an instance of CriteriaBuilder for the creation of CriteriaQuery objects.<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>getMetamodel &#8211; Return an instance of Metamodel interface for access to the metamodel of the persistence unit.<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>createEntityGraph &#8211; Return a mutable EntityGraph that can be used to dynamically create an EntityGraph.<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>getEntityGraph \u2013 returns a named entityGraph<\/ol>\n<p>\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u306e\u4f8b\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u901a\u3058\u3066\u3001\u3044\u304f\u3064\u304b\u306e\u65b9\u6cd5\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<h3>\u30d2\u30d9\u30eb\u30cd\u30fc\u30c8\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u306e\u4f8b<\/h3>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/65649583daa94e2bdf7bf77f\/8-0.png\" alt=\"JPA EntityManager, Hibernate EntityManager example\" \/><\/div>\n<pre class=\"post-pre\"><code>CREATE TABLE `employee` (\r\n  `employee_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\r\n  `employee_name` varchar(32) NOT NULL DEFAULT '',\r\n  PRIMARY KEY (`employee_id`)\r\n) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;\r\n<\/code><\/pre>\n<p>\u79c1\u305f\u3061\u306e\u4f8b\u306b\u306f\u975e\u5e38\u306b\u30b7\u30f3\u30d7\u30eb\u306a\u30c6\u30fc\u30d6\u30eb\u3067\u3059\u304c\u3001\u305d\u308c\u306f\u79c1\u305f\u3061\u304cEntityManager\u306e\u4f7f\u7528\u3092\u793a\u3059\u305f\u3081\u306b\u6700\u9069\u3067\u3059\u3002<\/p>\n<h3>\u30d2\u30d0\u30cd\u30a4\u30c8\u306eMaven\u4f9d\u5b58\u95a2\u4fc2<\/h3>\n<p>\u79c1\u305f\u3061\u306fpom.xml\u30d5\u30a1\u30a4\u30eb\u306bHibernate\u3068MySQL\u306eJava\u30c9\u30e9\u30a4\u30d0\u306e\u4f9d\u5b58\u95a2\u4fc2\u3092\u542b\u3081\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u79c1\u306f\u6700\u65b0\u306emysql-connector-java\u306ejar\u3092\u4f7f\u7528\u3057\u3066Hibernate 5\u3092\u5229\u7528\u3057\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\"\r\n\txsi:schemaLocation=\"https:\/\/maven.apache.org\/POM\/4.0.0 https:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd\"&gt;\r\n\t&lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;\r\n\r\n\t&lt;groupId&gt;com.scdev.hibernate&lt;\/groupId&gt;\r\n\t&lt;artifactId&gt;hibernate-entitymanager&lt;\/artifactId&gt;\r\n\t&lt;version&gt;0.0.1-SNAPSHOT&lt;\/version&gt;\r\n\t&lt;packaging&gt;jar&lt;\/packaging&gt;\r\n\r\n\t&lt;name&gt;hibernate-entitymanager&lt;\/name&gt;\r\n\t&lt;url&gt;https:\/\/maven.apache.org&lt;\/url&gt;\r\n\r\n\t&lt;properties&gt;\r\n\t\t&lt;project.build.sourceEncoding&gt;UTF-8&lt;\/project.build.sourceEncoding&gt;\r\n\t&lt;\/properties&gt;\r\n\r\n\t&lt;dependencies&gt;\r\n\t\t&lt;!-- MySQL connector --&gt;\r\n\t\t&lt;dependency&gt;\r\n\t\t\t&lt;groupId&gt;mysql&lt;\/groupId&gt;\r\n\t\t\t&lt;artifactId&gt;mysql-connector-java&lt;\/artifactId&gt;\r\n\t\t\t&lt;version&gt;6.0.5&lt;\/version&gt;\r\n\t\t&lt;\/dependency&gt;\r\n\t\t&lt;!-- Hibernate 5.2.6 Final --&gt;\r\n\t\t&lt;dependency&gt;\r\n\t\t\t&lt;groupId&gt;org.hibernate&lt;\/groupId&gt;\r\n\t\t\t&lt;artifactId&gt;hibernate-core&lt;\/artifactId&gt;\r\n\t\t\t&lt;version&gt;5.2.6.Final&lt;\/version&gt;\r\n\t\t&lt;\/dependency&gt;\r\n\t\t&lt;dependency&gt;\r\n\t\t\t&lt;groupId&gt;junit&lt;\/groupId&gt;\r\n\t\t\t&lt;artifactId&gt;junit&lt;\/artifactId&gt;\r\n\t\t\t&lt;version&gt;3.8.1&lt;\/version&gt;\r\n\t\t\t&lt;scope&gt;test&lt;\/scope&gt;\r\n\t\t&lt;\/dependency&gt;\r\n\t&lt;\/dependencies&gt;\r\n\r\n\t&lt;build&gt;\r\n\t\t&lt;sourceDirectory&gt;src\/main\/java&lt;\/sourceDirectory&gt;\r\n\t\t&lt;plugins&gt;\r\n\t\t\t&lt;plugin&gt;\r\n\t\t\t\t&lt;artifactId&gt;maven-compiler-plugin&lt;\/artifactId&gt;\r\n\t\t\t\t&lt;version&gt;3.5.1&lt;\/version&gt;\r\n\t\t\t\t&lt;configuration&gt;\r\n\t\t\t\t\t&lt;source&gt;1.8&lt;\/source&gt;\r\n\t\t\t\t\t&lt;target&gt;1.8&lt;\/target&gt;\r\n\t\t\t\t&lt;\/configuration&gt;\r\n\t\t\t&lt;\/plugin&gt;\r\n\t\t&lt;\/plugins&gt;\r\n\t&lt;\/build&gt;\r\n&lt;\/project&gt;\r\n<\/code><\/pre>\n<h3>Hibernate\u306epersistence.xml<\/h3>\n<p>Hibernate\u3092\u4f7f\u7528\u3059\u308b\u969b\u306b\u6700\u3082\u91cd\u8981\u306a\u90e8\u5206\u306f\u3001persistence.xml\u30d5\u30a1\u30a4\u30eb\u3092\u63d0\u4f9b\u3059\u308b\u3053\u3068\u3067\u3059\u3002\u3053\u306exml\u30d5\u30a1\u30a4\u30eb\u306b\u306f\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3078\u306e\u63a5\u7d9a\u8a2d\u5b9a\u304c\u4fdd\u6301\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>&lt;persistence xmlns=\"https:\/\/xmlns.jcp.org\/xml\/ns\/persistence\"\r\n\txmlns:xsi=\"https:\/\/www.w3.org\/2001\/XMLSchema-instance\"\r\n\txsi:schemaLocation=\"https:\/\/xmlns.jcp.org\/xml\/ns\/persistence\r\n             https:\/\/xmlns.jcp.org\/xml\/ns\/persistence\/persistence_2_1.xsd\"\r\n\tversion=\"2.1\"&gt;\r\n\r\n\t&lt;persistence-unit name=\"persistence\"&gt;\r\n\t\t&lt;description&gt;Hibernate Entity Manager Example&lt;\/description&gt;\r\n\t\t&lt;provider&gt;org.hibernate.jpa.HibernatePersistenceProvider&lt;\/provider&gt;\r\n\r\n\t\t&lt;properties&gt;\r\n\t\t\t&lt;property name=\"javax.persistence.jdbc.driver\" value=\"com.mysql.jdbc.Driver\" \/&gt;\r\n\t\t\t&lt;property name=\"javax.persistence.jdbc.url\" value=\"jdbc:mysql:\/\/localhost:3306\/Test\" \/&gt;\r\n\t\t\t&lt;property name=\"javax.persistence.jdbc.user\" value=\"scdev\" \/&gt;\r\n\t\t\t&lt;property name=\"javax.persistence.jdbc.password\" value=\"scdev\" \/&gt;\r\n\t\t\t&lt;property name=\"hibernate.show_sql\" value=\"true\" \/&gt;\r\n\t\t&lt;\/properties&gt;\r\n\r\n\t&lt;\/persistence-unit&gt;\r\n\r\n&lt;\/persistence&gt;\r\n<\/code><\/pre>\n<ul class=\"post-ul\">\n<li>hibernate.show_sql is used to tell hibernate to print sql queries into log files or console.<\/li>\n<li>The most important configuration is provider class i.e. org.hibernate.jpa.HibernatePersistenceProvider. This is how Hibernate is hooked into our application to be used as JPA implementation.<\/li>\n<li>There are properties to connect to your database and driver to use.<\/li>\n<li>It is important to note that persistence.xml should be placed in the META-INF directory, as you can see from the project image.<\/li>\n<\/ul>\n<h3>\u30d2\u30d9\u30eb\u30cd\u30a4\u30c8\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30d3\u30fc\u30f3<\/h3>\n<p>\u79c1\u305f\u3061\u306f\u4eca\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3067\u4f5c\u6210\u3055\u308c\u305f\u5f93\u696d\u54e1\u30c6\u30fc\u30d6\u30eb\u306b\u5bfe\u5fdc\u3059\u308bEmployee.java\u30af\u30e9\u30b9\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002Employee\u30af\u30e9\u30b9\u306f\u3001@Entity\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u3092\u4f7f\u7528\u3057\u3066\u5ba3\u8a00\u3055\u308c\u305f\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u3067\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>package com.scdev.jpa.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.Table;\r\n\r\n@Entity\r\n@Table(name = \"employee\")\r\npublic class Employee {\r\n\tprivate int employeeId;\r\n\r\n\tprivate String name;\r\n\r\n\t@Id\r\n\t@Column(name = \"employee_id\")\r\n\t@GeneratedValue(strategy = GenerationType.IDENTITY)\r\n\tpublic int getEmployeeId() {\r\n\t\treturn employeeId;\r\n\t}\r\n\r\n\tpublic void setEmployeeId(int employeeId) {\r\n\t\tthis.employeeId = employeeId;\r\n\t}\r\n\r\n\t@Column(name = \"employee_name\")\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\t@Override\r\n\tpublic String toString() {\r\n\t\treturn \"Employee [employeeId=\" + employeeId + \", name=\" + name + \"]\";\r\n\t}\r\n\r\n}\r\n<\/code><\/pre>\n<p>\u4eca\u306f\u3001\u79c1\u305f\u3061\u306e\u30e1\u30a4\u30f3\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u6210\u3057\u3001EntityManager\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3057\u3066\u3044\u304f\u3064\u304b\u306e\u30af\u30a8\u30ea\u3092\u5b9f\u884c\u3059\u308b\u6642\u9593\u3067\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>package com.scdev.jpa.hibernate.main;\r\n\r\nimport java.util.List;\r\n\r\nimport javax.persistence.EntityManager;\r\nimport javax.persistence.EntityManagerFactory;\r\nimport javax.persistence.Persistence;\r\n\r\nimport com.scdev.jpa.hibernate.model.Employee;\r\n\r\npublic class App {\r\n\tpublic static void main(String[] args) {\r\n\t\tEntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory(\"persistence\");\r\n\t\tEntityManager entityManager = entityManagerFactory.createEntityManager();\r\n\r\n\t\tSystem.out.println(\"Starting Transaction\");\r\n\t\tentityManager.getTransaction().begin();\r\n\t\tEmployee employee = new Employee();\r\n\t\temployee.setName(\"Pankaj\");\r\n\t\tSystem.out.println(\"Saving Employee to Database\");\r\n\r\n\t\tentityManager.persist(employee);\r\n\t\tentityManager.getTransaction().commit();\r\n\t\tSystem.out.println(\"Generated Employee ID = \" + employee.getEmployeeId());\r\n\r\n\t\t\/\/ get an object using primary key.\r\n\t\tEmployee emp = entityManager.find(Employee.class, employee.getEmployeeId());\r\n\t\tSystem.out.println(\"got object \" + emp.getName() + \" \" + emp.getEmployeeId());\r\n\r\n\t\t\/\/ get all the objects from Employee table\r\n\t\t@SuppressWarnings(\"unchecked\")\r\n\t\tList&lt;Employee&gt; listEmployee = entityManager.createQuery(\"SELECT e FROM Employee e\").getResultList();\r\n\r\n\t\tif (listEmployee == null) {\r\n\t\t\tSystem.out.println(\"No employee found . \");\r\n\t\t} else {\r\n\t\t\tfor (Employee empl : listEmployee) {\r\n\t\t\t\tSystem.out.println(\"Employee name= \" + empl.getName() + \", Employee id \" + empl.getEmployeeId());\r\n\t\t\t}\r\n\t\t}\r\n\t\t\/\/ remove and entity\r\n\t\tentityManager.getTransaction().begin();\r\n\t\tSystem.out.println(\"Deleting Employee with ID = \" + emp.getEmployeeId());\r\n\t\tentityManager.remove(emp);\r\n\t\tentityManager.getTransaction().commit();\r\n\r\n\t\t\/\/ close the entity manager\r\n\t\tentityManager.close();\r\n\t\tentityManagerFactory.close();\r\n\r\n\t}\r\n}\r\n<\/code><\/pre>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>Persistence.createEntityManagerFactory\u306f\u3001persistence.xml\u30d5\u30a1\u30a4\u30eb\u3067\u63d0\u4f9b\u3055\u308c\u305fpersistence-unit\u3092\u4f7f\u7528\u3057\u3066EntityManagerFactory\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>entityManagerFactory.createEntityManager()\u306f\u3001\u79c1\u305f\u3061\u304c\u4f7f\u7528\u3059\u308b\u305f\u3081\u306eEntityManager\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002createEntityManager()\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u51fa\u3059\u305f\u3073\u306b\u3001\u65b0\u3057\u3044EntityManager\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u8fd4\u3055\u308c\u307e\u3059\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>entityManager.getTransaction().begin()\u30e1\u30bd\u30c3\u30c9\u306f\u3001\u6700\u521d\u306b\u73fe\u5728\u306e\u6c38\u7d9a\u5316\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u304b\u3089\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u3092\u53d6\u5f97\u3057\u3001begin()\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3057\u3066\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u3092\u958b\u59cb\u3057\u307e\u3059\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>entityManager.persist(employee)\u306f\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306bemployee\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u6c38\u7d9a\u5316\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3055\u308c\u307e\u3059\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>entityManager.getTransaction().commit()\u30e1\u30bd\u30c3\u30c9\u306f\u3001\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u3092\u53d6\u5f97\u3057\u3001\u540c\u3058\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u3092\u30b3\u30df\u30c3\u30c8\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3055\u308c\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u3059\u3079\u3066\u306e\u5909\u66f4\u304c\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u30b3\u30df\u30c3\u30c8\u3055\u308c\u307e\u3059\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>entityManager.find()\u306f\u3001\u4e3b\u30ad\u30fc\u3092\u4f7f\u7528\u3057\u3066\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u5185\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u3092\u691c\u7d22\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3055\u308c\u307e\u3059\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>\u30ab\u30b9\u30bf\u30e0\u30af\u30a8\u30ea\u3092\u66f8\u304d\u305f\u3044\u5834\u5408\u306f\u3001entityManager.createQuery()\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3053\u3053\u3067\u91cd\u8981\u306a\u30dd\u30a4\u30f3\u30c8\u306f\u3001createQuery()\u30e1\u30bd\u30c3\u30c9\u306b\u306f\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30af\u30e9\u30b9\u306b\u6307\u5b9a\u3055\u308c\u305f\u540d\u524d\u304c\u3042\u308b\u3053\u3068\u3067\u3059\u3002\u5b9f\u969b\u306e\u30c6\u30fc\u30d6\u30eb\u540d\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>entityManager.remove()\u306f\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304b\u3089\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u3092\u524a\u9664\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u5834\u5408\u306b\u306e\u307f\u4f7f\u7528\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>entityManager.close()\u306f\u3001\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u3092\u9589\u3058\u308b\u305f\u3081\u306b\u4f7f\u7528\u3055\u308c\u307e\u3059\u3002\u540c\u69d8\u306bentityManagerFactory.close()\u306fEntityManagerFactory\u3092\u9589\u3058\u308b\u305f\u3081\u306b\u4f7f\u7528\u3055\u308c\u307e\u3059\u3002\u3053\u308c\u3089\u306e\u30ea\u30bd\u30fc\u30b9\u306f\u4f7f\u7528\u304c\u7d42\u308f\u3063\u305f\u3089\u3059\u3050\u306b\u9589\u3058\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/ol>\n<p>\u4e0a\u8a18\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u5b9f\u884c\u4f8b\u304b\u3089\u751f\u6210\u3055\u308c\u305f\u51fa\u529b\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>Starting Transaction\r\nSaving Employee to Database\r\nHibernate: insert into employee (employee_name) values (?)\r\nGenerated Employee ID = 11\r\ngot object Pankaj 11\r\nDec 07, 2017 1:05:23 PM org.hibernate.hql.internal.QueryTranslatorFactoryInitiator initiateService\r\nINFO: HHH000397: Using ASTQueryTranslatorFactory\r\nHibernate: select employee0_.employee_id as employee1_0_, employee0_.employee_name as employee2_0_ from employee employee0_\r\nEmployee name= Test, Employee id 5\r\nEmployee name= Pankaj, Employee id 6\r\nEmployee name= Pankaj, Employee id 11\r\nDeleting Employee with ID = 11\r\nHibernate: delete from employee where employee_id=?\r\n<\/code><\/pre>\n<p>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u4fdd\u5b58\u3055\u308c\u308b\u969b\u306b\u5f93\u696d\u54e1ID\u304c\u751f\u6210\u3055\u308c\u3001\u305d\u308c\u304c\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u30de\u30c3\u30d4\u30f3\u30b0\u3055\u308c\u308b\u3053\u3068\u306b\u6ce8\u76ee\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u307e\u305f\u3001\u30b3\u30f3\u30bd\u30fc\u30eb\u306b\u8868\u793a\u3055\u308c\u308bSQL\u30af\u30a8\u30ea\u306b\u3082\u6ce8\u76ee\u3057\u3066\u304f\u3060\u3055\u3044\u3002Hibernate\u306f\u3055\u3089\u306b\u30ed\u30b0\u3092\u751f\u6210\u3057\u307e\u3059\u304c\u3001\u53ef\u8aad\u6027\u3092\u4fdd\u3064\u305f\u3081\u3001\u3053\u3053\u3067\u306f\u7701\u7565\u3057\u3066\u3044\u307e\u3059\u3002\u3053\u308c\u304cJPA EntityManager\u3068\u305d\u306eHibernate\u5b9f\u88c5\u306e\u4f8b\u3067\u3059\u3002\u6700\u7d42\u7684\u306aHibernate EntityManager\u306e\u4f8b\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306f\u4ee5\u4e0b\u306e\u30ea\u30f3\u30af\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u300cJPA Hibernate EntityManager\u306e\u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u300d<\/p>\n<p>\u53c2\u7167\uff1aAPI\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/p>\n","protected":false},"excerpt":{"rendered":"<p>JPA EntityManager\u306f\u3001Java Persistence API\u306e\u4e2d\u5fc3\u306b\u4f4d\u7f6e\u3057\u3066\u3044\u307e\u3059\u3002Hibernate\u306f\u3001\u6700\u3082\u5e83\u304f\u4f7f\u308f\u308c\u3066\u3044\u308bJPA\u306e\u5b9f\u88c5\u3067\u3059\u3002 JPA\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3 One of the mo [&hellip;]<\/p>\n","protected":false},"author":12,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[26,61],"class_list":["post-683","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>JPA\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u3068Hibernate\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"JPA\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u3068Hibernate\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\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\/jpa\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u3068hibernate\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\/\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JPA\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u3068Hibernate\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\" \/>\n<meta property=\"og:description\" content=\"JPA\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u3068Hibernate\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\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\/jpa\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u3068hibernate\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2022-11-18T23:27:24+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-07-31T16:38:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/65649583daa94e2bdf7bf77f\/8-0.png\" \/>\n<meta name=\"author\" content=\"\u5149, \u660e\" \/>\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=\"\u5149, \u660e\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"30\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\/jpa%e3%81%ae%e3%82%a8%e3%83%b3%e3%83%86%e3%82%a3%e3%83%86%e3%82%a3%e3%83%9e%e3%83%8d%e3%83%bc%e3%82%b8%e3%83%a3%e3%83%bc%e3%81%a8hibernate%e3%81%ae%e3%82%a8%e3%83%b3%e3%83%86%e3%82%a3%e3%83%86\/\",\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/jpa%e3%81%ae%e3%82%a8%e3%83%b3%e3%83%86%e3%82%a3%e3%83%86%e3%82%a3%e3%83%9e%e3%83%8d%e3%83%bc%e3%82%b8%e3%83%a3%e3%83%bc%e3%81%a8hibernate%e3%81%ae%e3%82%a8%e3%83%b3%e3%83%86%e3%82%a3%e3%83%86\/\",\"name\":\"JPA\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u3068Hibernate\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#website\"},\"datePublished\":\"2022-11-18T23:27:24+00:00\",\"dateModified\":\"2025-07-31T16:38:04+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/9ee62cea876d247deba14a0ac7ba5b55\"},\"description\":\"JPA\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u3068Hibernate\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\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\/jpa%e3%81%ae%e3%82%a8%e3%83%b3%e3%83%86%e3%82%a3%e3%83%86%e3%82%a3%e3%83%9e%e3%83%8d%e3%83%bc%e3%82%b8%e3%83%a3%e3%83%bc%e3%81%a8hibernate%e3%81%ae%e3%82%a8%e3%83%b3%e3%83%86%e3%82%a3%e3%83%86\/#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/ja\/blog\/jpa%e3%81%ae%e3%82%a8%e3%83%b3%e3%83%86%e3%82%a3%e3%83%86%e3%82%a3%e3%83%9e%e3%83%8d%e3%83%bc%e3%82%b8%e3%83%a3%e3%83%bc%e3%81%a8hibernate%e3%81%ae%e3%82%a8%e3%83%b3%e3%83%86%e3%82%a3%e3%83%86\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/jpa%e3%81%ae%e3%82%a8%e3%83%b3%e3%83%86%e3%82%a3%e3%83%86%e3%82%a3%e3%83%9e%e3%83%8d%e3%83%bc%e3%82%b8%e3%83%a3%e3%83%bc%e3%81%a8hibernate%e3%81%ae%e3%82%a8%e3%83%b3%e3%83%86%e3%82%a3%e3%83%86\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/ja\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JPA\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u3068Hibernate\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\"}]},{\"@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\/9ee62cea876d247deba14a0ac7ba5b55\",\"name\":\"\u5149, \u660e\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/3dffb6c754b95e3fbdcd8973f4375ff9dd10d41e4f6632ad08d4d59ccc35af8d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/3dffb6c754b95e3fbdcd8973f4375ff9dd10d41e4f6632ad08d4d59ccc35af8d?s=96&d=mm&r=g\",\"caption\":\"\u5149, \u660e\"},\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/author\/hikariakira\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/jpa%e3%81%ae%e3%82%a8%e3%83%b3%e3%83%86%e3%82%a3%e3%83%86%e3%82%a3%e3%83%9e%e3%83%8d%e3%83%bc%e3%82%b8%e3%83%a3%e3%83%bc%e3%81%a8hibernate%e3%81%ae%e3%82%a8%e3%83%b3%e3%83%86%e3%82%a3%e3%83%86\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"JPA\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u3068Hibernate\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc - Blog - Silicon Cloud","description":"JPA\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u3068Hibernate\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\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\/jpa\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u3068hibernate\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\/","og_locale":"ja_JP","og_type":"article","og_title":"JPA\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u3068Hibernate\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc","og_description":"JPA\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u3068Hibernate\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\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\/jpa\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u3068hibernate\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2022-11-18T23:27:24+00:00","article_modified_time":"2025-07-31T16:38:04+00:00","og_image":[{"url":"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/65649583daa94e2bdf7bf77f\/8-0.png"}],"author":"\u5149, \u660e","twitter_card":"summary_large_image","twitter_misc":{"\u57f7\u7b46\u8005":"\u5149, \u660e","\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593":"30\u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/ja\/blog\/jpa%e3%81%ae%e3%82%a8%e3%83%b3%e3%83%86%e3%82%a3%e3%83%86%e3%82%a3%e3%83%9e%e3%83%8d%e3%83%bc%e3%82%b8%e3%83%a3%e3%83%bc%e3%81%a8hibernate%e3%81%ae%e3%82%a8%e3%83%b3%e3%83%86%e3%82%a3%e3%83%86\/","url":"https:\/\/www.silicloud.com\/ja\/blog\/jpa%e3%81%ae%e3%82%a8%e3%83%b3%e3%83%86%e3%82%a3%e3%83%86%e3%82%a3%e3%83%9e%e3%83%8d%e3%83%bc%e3%82%b8%e3%83%a3%e3%83%bc%e3%81%a8hibernate%e3%81%ae%e3%82%a8%e3%83%b3%e3%83%86%e3%82%a3%e3%83%86\/","name":"JPA\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u3068Hibernate\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#website"},"datePublished":"2022-11-18T23:27:24+00:00","dateModified":"2025-07-31T16:38:04+00:00","author":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/9ee62cea876d247deba14a0ac7ba5b55"},"description":"JPA\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u3068Hibernate\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\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\/jpa%e3%81%ae%e3%82%a8%e3%83%b3%e3%83%86%e3%82%a3%e3%83%86%e3%82%a3%e3%83%9e%e3%83%8d%e3%83%bc%e3%82%b8%e3%83%a3%e3%83%bc%e3%81%a8hibernate%e3%81%ae%e3%82%a8%e3%83%b3%e3%83%86%e3%82%a3%e3%83%86\/#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/ja\/blog\/jpa%e3%81%ae%e3%82%a8%e3%83%b3%e3%83%86%e3%82%a3%e3%83%86%e3%82%a3%e3%83%9e%e3%83%8d%e3%83%bc%e3%82%b8%e3%83%a3%e3%83%bc%e3%81%a8hibernate%e3%81%ae%e3%82%a8%e3%83%b3%e3%83%86%e3%82%a3%e3%83%86\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/ja\/blog\/jpa%e3%81%ae%e3%82%a8%e3%83%b3%e3%83%86%e3%82%a3%e3%83%86%e3%82%a3%e3%83%9e%e3%83%8d%e3%83%bc%e3%82%b8%e3%83%a3%e3%83%bc%e3%81%a8hibernate%e3%81%ae%e3%82%a8%e3%83%b3%e3%83%86%e3%82%a3%e3%83%86\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/ja\/blog\/"},{"@type":"ListItem","position":2,"name":"JPA\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u3068Hibernate\u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u30de\u30cd\u30fc\u30b8\u30e3\u30fc"}]},{"@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\/9ee62cea876d247deba14a0ac7ba5b55","name":"\u5149, \u660e","image":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/3dffb6c754b95e3fbdcd8973f4375ff9dd10d41e4f6632ad08d4d59ccc35af8d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3dffb6c754b95e3fbdcd8973f4375ff9dd10d41e4f6632ad08d4d59ccc35af8d?s=96&d=mm&r=g","caption":"\u5149, \u660e"},"url":"https:\/\/www.silicloud.com\/ja\/blog\/author\/hikariakira\/"},{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/jpa%e3%81%ae%e3%82%a8%e3%83%b3%e3%83%86%e3%82%a3%e3%83%86%e3%82%a3%e3%83%9e%e3%83%8d%e3%83%bc%e3%82%b8%e3%83%a3%e3%83%bc%e3%81%a8hibernate%e3%81%ae%e3%82%a8%e3%83%b3%e3%83%86%e3%82%a3%e3%83%86\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/683","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\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/comments?post=683"}],"version-history":[{"count":1,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/683\/revisions"}],"predecessor-version":[{"id":43698,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/683\/revisions\/43698"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/media?parent=683"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/categories?post=683"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/tags?post=683"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}