{"id":490,"date":"2022-09-06T18:13:31","date_gmt":"2023-09-05T12:54:23","guid":{"rendered":"https:\/\/www.silicloud.com\/ja\/blog\/index.php\/2023\/11\/30\/%e3%83%8d%e3%82%a4%e3%83%86%e3%82%a3%e3%83%96%e3%81%aa%e6%97%a5%e6%9c%ac%e8%aa%9e%e3%81%a7%e4%bb%a5%e4%b8%8b%e3%81%ae%e5%86%85%e5%ae%b9%e3%82%92%e8%a8%80%e3%81%84%e6%8f%9b%e3%81%88%e3%82%8b%e3%81%a8\/"},"modified":"2025-07-31T23:59:30","modified_gmt":"2025-07-31T14:59:30","slug":"%e3%83%8d%e3%82%a4%e3%83%86%e3%82%a3%e3%83%96%e3%81%aa%e6%97%a5%e6%9c%ac%e8%aa%9e%e3%81%a7%e4%bb%a5%e4%b8%8b%e3%81%ae%e5%86%85%e5%ae%b9%e3%82%92%e8%a8%80%e3%81%84%e6%8f%9b%e3%81%88%e3%82%8b%e3%81%a8","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/ja\/blog\/%e3%83%8d%e3%82%a4%e3%83%86%e3%82%a3%e3%83%96%e3%81%aa%e6%97%a5%e6%9c%ac%e8%aa%9e%e3%81%a7%e4%bb%a5%e4%b8%8b%e3%81%ae%e5%86%85%e5%ae%b9%e3%82%92%e8%a8%80%e3%81%84%e6%8f%9b%e3%81%88%e3%82%8b%e3%81%a8\/","title":{"rendered":"\u30cd\u30a4\u30c6\u30a3\u30d6\u306a\u65e5\u672c\u8a9e\u3067\u4ee5\u4e0b\u306e\u5185\u5bb9\u3092\u8a00\u3044\u63db\u3048\u308b\u3068\u3001\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306b\u3088\u308bHibernate One to One\u306e\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u4f8b\u304c\u3042\u308a\u307e\u3059\u3002\u30d2\u30d9\u30eb\u30cd\u30fc\u30c8\u306eOne to One\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306e\u4f8b"},"content":{"rendered":"<p>\u4eca\u65e5\u306fHibernate\u306eOne to One\u30de\u30c3\u30d4\u30f3\u30b0\u3092\u898b\u3066\u3044\u304d\u307e\u3059\u3002\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u3068XML\u69cb\u6210\u3092\u4f7f\u7528\u3057\u305fHibernate\u306eOne to One\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u4f8b\u3092\u898b\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<h2>\u30d2\u30d0\u30cd\u30a4\u30c8\u306b\u304a\u3051\u308b\u30ef\u30f3\u30fb\u30c8\u30a5\u30fb\u30ef\u30f3\u30fb\u30de\u30c3\u30d4\u30f3\u30b0<\/h2>\n<p>\u307b\u3068\u3093\u3069\u306e\u5834\u5408\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30c6\u30fc\u30d6\u30eb\u306f\u4e92\u3044\u306b\u95a2\u9023\u4ed8\u3051\u3089\u308c\u3066\u3044\u307e\u3059\u3002\u95a2\u9023\u4ed8\u3051\u306b\u306f\u3055\u307e\u3056\u307e\u306a\u5f62\u5f0f\u304c\u3042\u308a\u307e\u3059\u3002\u4e00\u5bfe\u4e00\u3001\u4e00\u5bfe\u591a\u3001\u591a\u5bfe\u591a\u304c\u5e83\u7bc4\u306a\u30ec\u30d9\u30eb\u3067\u5b58\u5728\u3057\u307e\u3059\u3002\u3053\u308c\u3089\u306f\u3001\u5358\u65b9\u5411\u3068\u53cc\u65b9\u5411\u306e\u30de\u30c3\u30d4\u30f3\u30b0\u306b\u3055\u3089\u306b\u5206\u3051\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4eca\u65e5\u306f\u3001XML\u69cb\u6210\u304a\u3088\u3073\u6ce8\u91c8\u69cb\u6210\u3092\u4f7f\u7528\u3057\u305fHibernate One to One Mapping\u306e\u5b9f\u88c5\u65b9\u6cd5\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<h3>\u30ef\u30f3\u30fb\u30c8\u30a5\u30fb\u30ef\u30f3\u30fb\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u4f8b\u3068\u3057\u3066\u306e\u3001Hibernate \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7<\/h3>\n<p>\u307e\u305a\u6700\u521d\u306b\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30c6\u30fc\u30d6\u30eb\u306b\u306f\u4e00\u5bfe\u4e00\u306e\u30de\u30c3\u30d4\u30f3\u30b0\u3092\u8a2d\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u306e\u4f8b\u3067\u306f\u3001\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u3068\u9867\u5ba2\u306e2\u3064\u306e\u30c6\u30fc\u30d6\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u3053\u308c\u3089\u306e\u30c6\u30fc\u30d6\u30eb\u306f\u3044\u305a\u308c\u3082\u4e00\u5bfe\u4e00\u306e\u30de\u30c3\u30d4\u30f3\u30b0\u3092\u6301\u3061\u307e\u3059\u3002\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u304c\u4e3b\u30c6\u30fc\u30d6\u30eb\u3067\u3042\u308a\u3001\u9867\u5ba2\u30c6\u30fc\u30d6\u30eb\u3067\u306f\u4e00\u5bfe\u4e00\u306e\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u305f\u3081\u306b\u5916\u90e8\u30ad\u30fc\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306fMySQL\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u63d0\u4f9b\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u4ed6\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4f7f\u7528\u3057\u3066\u3044\u308b\u5834\u5408\u306f\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u9069\u5b9c\u5909\u66f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"post-pre\"><code>-- Create Transaction Table\r\nCREATE TABLE `Transaction` (\r\n  `txn_id` int(11) unsigned NOT NULL AUTO_INCREMENT,\r\n  `txn_date` date NOT NULL,\r\n  `txn_total` decimal(10,0) NOT NULL,\r\n  PRIMARY KEY (`txn_id`)\r\n) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8;\r\n\r\n-- Create Customer table\r\nCREATE TABLE `Customer` (\r\n  `txn_id` int(11) unsigned NOT NULL,\r\n  `cust_name` varchar(20) NOT NULL DEFAULT '',\r\n  `cust_email` varchar(20) DEFAULT NULL,\r\n  `cust_address` varchar(50) NOT NULL DEFAULT '',\r\n  PRIMARY KEY (`txn_id`),\r\n  CONSTRAINT `customer_ibfk_1` FOREIGN KEY (`txn_id`) REFERENCES `Transaction` (`txn_id`)\r\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;\r\n<\/code><\/pre>\n<p>\u4e0a\u8a18\u306e\u30c6\u30fc\u30d6\u30eb\u9593\u306e\u4e00\u5bfe\u4e00\u306e\u30de\u30c3\u30d4\u30f3\u30b0\u306b\u95a2\u3059\u308b\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u95a2\u4fc2\u56f3\uff08ERD\uff09\u306f\u3001\u4ee5\u4e0b\u306e\u753b\u50cf\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002\u79c1\u305f\u3061\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u8a2d\u5b9a\u306f\u5b8c\u4e86\u3057\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u6b21\u306bHibernate One to One\u306e\u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u9032\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<h3>\u30cd\u30a4\u30c6\u30a3\u30d6\u306e\u65e5\u672c\u8a9e\u3067\u4ee5\u4e0b\u3092\u8a00\u3044\u63db\u3048\u3066\u304f\u3060\u3055\u3044\u3002\u9078\u629e\u80a2\u306f\u4e00\u3064\u3060\u3051\u3067\u7d50\u69cb\u3067\u3059\u3002<br \/>\nHibernate\u306e\u4e00\u5bfe\u4e00\u306e\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u4f8b\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u69cb\u9020<\/h3>\n<p>Java\u306eIDE\u3001Eclipse\u3092\u4f7f\u7528\u3057\u3066\u3001\u30b7\u30f3\u30d7\u30eb\u306aMaven\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u6700\u7d42\u7684\u306a\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u69cb\u9020\u306f\u4ee5\u4e0b\u306e\u753b\u50cf\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002\u307e\u305a\u306fXML\u30d9\u30fc\u30b9\u306eHibernate One to One Mapping\u306e\u4f8b\u3092\u898b\u3066\u304b\u3089\u3001\u540c\u3058\u3053\u3068\u3092\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u3092\u4f7f\u7528\u3057\u3066\u5b9f\u88c5\u3057\u307e\u3059\u3002<\/p>\n<h3>\u30d2\u30d0\u30cd\u30a4\u30c8 \u30e1\u30a4\u30f4\u30f3 \u30c7\u30da\u30f3\u30c7\u30f3\u30b7\u30fc\u30ba<\/h3>\n<p>\u79c1\u305f\u3061\u306e\u6700\u7d42\u7684\u306apom.xml\u30d5\u30a1\u30a4\u30eb\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\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;HibernateOneToOneMapping&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<p>\u4f9d\u5b58\u95a2\u4fc2\u306f\u3001Hibernate\u3068MySQL\u306eJava\u30c9\u30e9\u30a4\u30d0\u30fc\u306b\u306e\u307f\u5fc5\u8981\u3067\u3059\u3002Hibernate\u306e\u6700\u65b0\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u3042\u308b4.3.5.Final\u3068\u3001MySQL\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30b5\u30fc\u30d0\u30fc\u30d0\u30fc\u30b8\u30e7\u30f3\uff085.0.5\uff09\u306b\u57fa\u3065\u3044\u3066MySQL\u306eJava\u30c9\u30e9\u30a4\u30d0\u30fc\u3092\u4f7f\u7528\u3057\u3066\u3044\u307e\u3059\u3002Hibernate 4\u3067\u306f\u3001JBoss\u306e\u30ed\u30ae\u30f3\u30b0\u304c\u4f7f\u7528\u3055\u308c\u3001\u63a8\u79fb\u7684\u306a\u4f9d\u5b58\u95a2\u4fc2\u3068\u3057\u3066\u81ea\u52d5\u7684\u306b\u30a4\u30f3\u30dd\u30fc\u30c8\u3055\u308c\u307e\u3059\u3002\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306eMaven\u306e\u4f9d\u5b58\u95a2\u4fc2\u3067\u78ba\u8a8d\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002Hibernate\u306e\u53e4\u3044\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u4f7f\u7528\u3057\u3066\u3044\u308b\u5834\u5408\u306f\u3001slf4j\u306e\u4f9d\u5b58\u95a2\u4fc2\u3092\u8ffd\u52a0\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<h3>\u30e2\u30c7\u30eb\u30af\u30e9\u30b9\u306eHibernate One to One\u30de\u30c3\u30d4\u30f3\u30b0<\/h3>\n<p>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30c6\u30fc\u30d6\u30eb\u3092\u53cd\u6620\u3059\u308b\u305f\u3081\u306eHibernate One to One\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u30e2\u30c7\u30eb\u30af\u30e9\u30b9\u306f\u3001\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 java.util.Date;\r\n\r\npublic class Txn {\r\n\r\n\tprivate long id;\r\n\tprivate Date date;\r\n\tprivate double total;\r\n\tprivate Customer customer;\r\n\t\r\n\t@Override\r\n\tpublic String toString(){\r\n\t\treturn id+\", \"+total+\", \"+customer.getName()+\", \"+customer.getEmail()+\", \"+customer.getAddress();\r\n\t}\r\n\tpublic long getId() {\r\n\t\treturn id;\r\n\t}\r\n\tpublic void setId(long id) {\r\n\t\tthis.id = id;\r\n\t}\r\n\tpublic Date getDate() {\r\n\t\treturn date;\r\n\t}\r\n\tpublic void setDate(Date date) {\r\n\t\tthis.date = date;\r\n\t}\r\n\tpublic double getTotal() {\r\n\t\treturn total;\r\n\t}\r\n\tpublic void setTotal(double total) {\r\n\t\tthis.total = total;\r\n\t}\r\n\tpublic Customer getCustomer() {\r\n\t\treturn customer;\r\n\t}\r\n\tpublic void setCustomer(Customer customer) {\r\n\t\tthis.customer = customer;\r\n\t}\r\n\t\r\n}\r\n<\/code><\/pre>\n<pre class=\"post-pre\"><code>package com.scdev.hibernate.model;\r\n\r\npublic class Customer {\r\n\r\n\tprivate long id;\r\n\tprivate String name;\r\n\tprivate String email;\r\n\tprivate String address;\r\n\t\r\n\tprivate Txn txn;\r\n\t\r\n\tpublic long getId() {\r\n\t\treturn id;\r\n\t}\r\n\tpublic void setId(long id) {\r\n\t\tthis.id = id;\r\n\t}\r\n\tpublic String getName() {\r\n\t\treturn name;\r\n\t}\r\n\tpublic void setName(String name) {\r\n\t\tthis.name = name;\r\n\t}\r\n\tpublic String getEmail() {\r\n\t\treturn email;\r\n\t}\r\n\tpublic void setEmail(String email) {\r\n\t\tthis.email = email;\r\n\t}\r\n\tpublic String getAddress() {\r\n\t\treturn address;\r\n\t}\r\n\tpublic void setAddress(String address) {\r\n\t\tthis.address = address;\r\n\t}\r\n\tpublic Txn getTxn() {\r\n\t\treturn txn;\r\n\t}\r\n\tpublic void setTxn(Txn txn) {\r\n\t\tthis.txn = txn;\r\n\t}\r\n\t\r\n}\r\n<\/code><\/pre>\n<p>XML\u30d9\u30fc\u30b9\u306e\u69cb\u6210\u3092\u4f7f\u7528\u3057\u3066\u3044\u308b\u305f\u3081\u3001\u4e0a\u8a18\u306e\u30e2\u30c7\u30eb\u30af\u30e9\u30b9\u306f\u30b7\u30f3\u30d7\u30eb\u306aPOJO\u30af\u30e9\u30b9\u307e\u305f\u306fJavaBeans\u3067\u3042\u308a\u3001getter-setter\u30e1\u30bd\u30c3\u30c9\u3092\u6301\u3063\u3066\u3044\u307e\u3059\u3002Hibernate API\u306b\u306fTransaction\u3068\u3044\u3046\u30af\u30e9\u30b9\u540d\u304c\u3042\u308b\u305f\u3081\u3001\u6df7\u4e71\u3092\u907f\u3051\u308b\u305f\u3081\u306bTxn\u3068\u3044\u3046\u30af\u30e9\u30b9\u540d\u3092\u4f7f\u7528\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<h3>Hibernate\u306e\u4e00\u5bfe\u4e00\u306e\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u8a2d\u5b9a<\/h3>\n<p>Txn\u3068Customer\u30c6\u30fc\u30d6\u30eb\u306e\u30d2\u30d9\u30eb\u30cd\u30fc\u30c8\u306e1\u5bfe1\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3057\u3087\u3046\u3002txn.hbm.xml<\/p>\n<pre class=\"post-pre\"><code>&lt;?xml version=\"1.0\"?&gt;\r\n&lt;!DOCTYPE hibernate-mapping PUBLIC \"-\/\/Hibernate\/Hibernate Mapping DTD 3.0\/\/EN\"\r\n\t\"https:\/\/hibernate.org\/dtd\/hibernate-mapping-3.0.dtd\"&gt;\r\n&lt;hibernate-mapping&gt;\r\n\t&lt;class name=\"com.scdev.hibernate.model.Txn\" table=\"TRANSACTION\" &gt;\r\n\t\t&lt;id name=\"id\" type=\"long\"&gt;\r\n\t\t\t&lt;column name=\"txn_id\" \/&gt;\r\n\t\t\t&lt;generator class=\"identity\" \/&gt;\r\n\t\t&lt;\/id&gt;\r\n\t\t&lt;property name=\"date\" type=\"date\"&gt;\r\n\t\t\t&lt;column name=\"txn_date\" \/&gt;\r\n\t\t&lt;\/property&gt;\r\n\t\t&lt;property name=\"total\" type=\"double\"&gt;\r\n\t\t\t&lt;column name=\"txn_total\" \/&gt;\r\n\t\t&lt;\/property&gt;\r\n\t\t&lt;one-to-one name=\"customer\" class=\"com.scdev.hibernate.model.Customer\"\r\n\t\t\tcascade=\"save-update\" \/&gt;\r\n\t&lt;\/class&gt;\r\n\t\r\n&lt;\/hibernate-mapping&gt;\r\n<\/code><\/pre>\n<p>\u4e0a\u8a18\u3067\u6ce8\u76ee\u3059\u3079\u304d\u91cd\u8981\u306a\u30dd\u30a4\u30f3\u30c8\u306f\u3001customer\u30d7\u30ed\u30d1\u30c6\u30a3\u306e\u30d2\u30d9\u30eb\u30cd\u30fc\u30c8\u306eone-to-one\u8981\u7d20\u3067\u3059\u3002customer.hbm.xml<\/p>\n<pre class=\"post-pre\"><code>&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n&lt;!DOCTYPE hibernate-mapping PUBLIC \"-\/\/Hibernate\/Hibernate Mapping DTD 3.0\/\/EN\" \r\n\"https:\/\/hibernate.org\/dtd\/hibernate-mapping-3.0.dtd\" &gt;\r\n&lt;hibernate-mapping&gt;\r\n\r\n\t&lt;class name=\"com.scdev.hibernate.model.Customer\" table=\"CUSTOMER\"&gt;\r\n\t\t&lt;id name=\"id\" type=\"long\"&gt;\r\n\t\t\t&lt;column name=\"txn_id\" \/&gt;\r\n\t\t\t&lt;generator class=\"foreign\"&gt;\r\n\t\t\t\t&lt;param name=\"property\"&gt;txn&lt;\/param&gt;\r\n\t\t\t&lt;\/generator&gt;\r\n\t\t&lt;\/id&gt;\r\n\t\t&lt;one-to-one name=\"txn\" class=\"com.scdev.hibernate.model.Txn\"\r\n\t\t\tconstrained=\"true\"&gt;&lt;\/one-to-one&gt;\r\n\r\n\t\t&lt;property name=\"name\" type=\"string\"&gt;\r\n\t\t\t&lt;column name=\"cust_name\"&gt;&lt;\/column&gt;\r\n\t\t&lt;\/property&gt;\r\n\t\t&lt;property name=\"email\" type=\"string\"&gt;\r\n\t\t\t&lt;column name=\"cust_email\"&gt;&lt;\/column&gt;\r\n\t\t&lt;\/property&gt;\r\n\t\t&lt;property name=\"address\" type=\"string\"&gt;\r\n\t\t\t&lt;column name=\"cust_address\"&gt;&lt;\/column&gt;\r\n\t\t&lt;\/property&gt;\r\n\t&lt;\/class&gt;\r\n\r\n&lt;\/hibernate-mapping&gt;\r\n<\/code><\/pre>\n<p>\u30b8\u30a7\u30cd\u30ec\u30fc\u30bf\u30fc\u30af\u30e9\u30b9\u300cforeign\u300d\u306f\u3001\u30d2\u30d9\u30eb\u30cd\u30fc\u30c8\u306e\u5916\u90e8\u30ad\u30fc\u5b9f\u88c5\u306b\u4f7f\u7528\u3055\u308c\u308b\u91cd\u8981\u306a\u90e8\u5206\u3067\u3059\u3002<\/p>\n<h3>\u30d2\u30d9\u30eb\u30cd\u30fc\u30c8\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb<\/h3>\n<p>\u3053\u3061\u3089\u306fXML\u30d9\u30fc\u30b9\u306eHibernate\u30de\u30c3\u30d4\u30f3\u30b0\u8a2d\u5b9a\u306e\u305f\u3081\u306eHibernate\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3067\u3042\u308a\u3001hibernate.cfg.xml\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 resource=\"txn.hbm.xml\"\/&gt;\r\n        &lt;mapping resource=\"customer.hbm.xml\"\/&gt;\r\n    &lt;\/session-factory&gt;\r\n&lt;\/hibernate-configuration&gt;\r\n<\/code><\/pre>\n<p>\u30d2\u30d9\u30eb\u30cd\u30fc\u30c8\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306f\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u63a5\u7d9a\u30d7\u30ed\u30d1\u30c6\u30a3\u3068\u30d2\u30d9\u30eb\u30cd\u30fc\u30c8\u306e\u30de\u30c3\u30d4\u30f3\u30b0\u30ea\u30bd\u30fc\u30b9\u3092\u6301\u3064\u30b7\u30f3\u30d7\u30eb\u306a\u3082\u306e\u3067\u3059\u3002<\/p>\n<h3>\u30cd\u30a4\u30c6\u30a3\u30d6\u65e5\u672c\u8a9e\u3067\u4ee5\u4e0b\u3092\u8a00\u3044\u63db\u3048\u307e\u3059\u3002\u30aa\u30d7\u30b7\u30e7\u30f3\u306f\uff11\u3064\u306e\u307f\u3067\u3059\uff1a<br \/>\nHibernate\u306eSessionFactory\u30e6\u30fc\u30c6\u30a3\u30ea\u30c6\u30a3<\/h3>\n<p>\u4ee5\u4e0b\u306fHibernate\u306eSessionFactory\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u6210\u3059\u308b\u305f\u3081\u306e\u30e6\u30fc\u30c6\u30a3\u30ea\u30c6\u30a3\u30af\u30e9\u30b9\u3067\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<p>\u305d\u308c\u3067\u3001Hibernate\u306e1\u5bfe1\u30de\u30c3\u30d4\u30f3\u30b0\u306eXML\u30d9\u30fc\u30b9\u306e\u8a2d\u5b9a\u3092\u30c6\u30b9\u30c8\u3059\u308b\u305f\u3081\u306e\u30c6\u30b9\u30c8\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u66f8\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<h3>\u30cd\u30a4\u30c6\u30a3\u30d6\u306a\u65e5\u672c\u8a9e\u3067\u4ee5\u4e0b\u3092\u8a00\u3044\u63db\u3048\u308b\uff08\u30aa\u30d7\u30b7\u30e7\u30f3\u306f1\u3064\u3060\u3051\u5fc5\u8981\uff09\uff1a<br \/>\n\u30cf\u30a4\u30d0\u30cd\u30fc\u30c8\u306e\u4e00\u5bfe\u4e00\u306e\u30de\u30c3\u30d4\u30f3\u30b0XML\u8a2d\u5b9a\u306e\u30c6\u30b9\u30c8\u30d7\u30ed\u30b0\u30e9\u30e0<\/h3>\n<p>\u30cf\u30a4\u30d0\u30cd\u30fc\u30c8\u306e\u4e00\u5bfe\u4e00\u306e\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u4f8b\u306e\u30c6\u30b9\u30c8\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u306f\u3001\u6700\u521d\u306b Txn \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u3066\u4fdd\u5b58\u3057\u307e\u3059\u3002\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u4fdd\u5b58\u3055\u308c\u305f\u3089\u3001\u751f\u6210\u3055\u308c\u305f ID \u3092\u4f7f\u7528\u3057\u3066 Txn \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u53d6\u5f97\u3057\u3001\u305d\u308c\u3092\u8868\u793a\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>package com.scdev.hibernate.main;\r\n\r\nimport java.util.Date;\r\n\r\nimport org.hibernate.Session;\r\nimport org.hibernate.SessionFactory;\r\nimport org.hibernate.Transaction;\r\n\r\nimport com.scdev.hibernate.model.Customer;\r\nimport com.scdev.hibernate.model.Txn;\r\nimport com.scdev.hibernate.util.HibernateUtil;\r\n\r\npublic class HibernateOneToOneMain {\r\n\r\n\tpublic static void main(String[] args) {\r\n\t\t\r\n\t\tTxn txn = buildDemoTransaction();\r\n\t\t\r\n\t\tSessionFactory sessionFactory = null;\r\n\t\tSession session = null;\r\n\t\tTransaction tx = null;\r\n\t\ttry{\r\n\t\t\/\/Get Session\r\n\t\tsessionFactory = HibernateUtil.getSessionFactory();\r\n\t\tsession = sessionFactory.getCurrentSession();\r\n\t\tSystem.out.println(\"Session created\");\r\n\t\t\/\/start transaction\r\n\t\ttx = session.beginTransaction();\r\n\t\t\/\/Save the Model object\r\n\t\tsession.save(txn);\r\n\t\t\/\/Commit transaction\r\n\t\ttx.commit();\r\n\t\tSystem.out.println(\"Transaction ID=\"+txn.getId());\r\n\t\t\r\n\t\t\/\/Get Saved Trasaction Data\r\n\t\tprintTransactionData(txn.getId(), sessionFactory);\r\n\t\t\r\n\t\t}catch(Exception e){\r\n\t\t\tSystem.out.println(\"Exception occured. \"+e.getMessage());\r\n\t\t\te.printStackTrace();\r\n\t\t}finally{\r\n\t\t\tif(!sessionFactory.isClosed()){\r\n\t\t\t\tSystem.out.println(\"Closing SessionFactory\");\r\n\t\t\t\tsessionFactory.close();\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tprivate static void printTransactionData(long id, SessionFactory sessionFactory) {\r\n\t\tSession session = null;\r\n\t\tTransaction tx = null;\r\n\t\ttry{\r\n\t\t\t\/\/Get Session\r\n\t\t\tsessionFactory = HibernateUtil.getSessionFactory();\r\n\t\t\tsession = sessionFactory.getCurrentSession();\r\n\t\t\t\/\/start transaction\r\n\t\t\ttx = session.beginTransaction();\r\n\t\t\t\/\/Save the Model object\r\n\t\t\tTxn txn = (Txn) session.get(Txn.class, id);\r\n\t\t\t\/\/Commit transaction\r\n\t\t\ttx.commit();\r\n\t\t\tSystem.out.println(\"Transaction Details=\\n\"+txn);\r\n\t\t\t\r\n\t\t\t}catch(Exception e){\r\n\t\t\t\tSystem.out.println(\"Exception occured. \"+e.getMessage());\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t}\r\n\r\n\tprivate static Txn buildDemoTransaction() {\r\n\t\tTxn txn = new Txn();\r\n\t\ttxn.setDate(new Date());\r\n\t\ttxn.setTotal(100);\r\n\t\t\r\n\t\tCustomer cust = new Customer();\r\n\t\tcust.setAddress(\"Bangalore, India\");\r\n\t\tcust.setEmail(\"scdev@gmail.com\");\r\n\t\tcust.setName(\"Pankaj Kumar\");\r\n\t\t\r\n\t\ttxn.setCustomer(cust);\r\n\t\t\r\n\t\tcust.setTxn(txn);\r\n\t\treturn txn;\r\n\t}\r\n\r\n}\r\n<\/code><\/pre>\n<p>\u4eca\u3001\u79c1\u305f\u3061\u306fHibernate\u306e\u30c6\u30b9\u30c8\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u4e0a\u8a18\u306e1\u5bfe1\u30de\u30c3\u30d4\u30f3\u30b0\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>Hibernate Configuration loaded\r\nHibernate serviceRegistry created\r\nSession created\r\nHibernate: insert into TRANSACTION (txn_date, txn_total) values (?, ?)\r\nHibernate: insert into CUSTOMER (cust_name, cust_email, cust_address, txn_id) values (?, ?, ?, ?)\r\nTransaction ID=19\r\nHibernate: select txn0_.txn_id as txn_id1_1_0_, txn0_.txn_date as txn_date2_1_0_, txn0_.txn_total as txn_tota3_1_0_, \r\ncustomer1_.txn_id as txn_id1_0_1_, customer1_.cust_name as cust_nam2_0_1_, customer1_.cust_email as cust_ema3_0_1_, \r\ncustomer1_.cust_address as cust_add4_0_1_ from TRANSACTION txn0_ left outer join CUSTOMER customer1_ on \r\ntxn0_.txn_id=customer1_.txn_id where txn0_.txn_id=?\r\nTransaction Details=\r\n19, 100.0, Pankaj Kumar, scdev@gmail.com, Bangalore, India\r\nClosing SessionFactory\r\n<\/code><\/pre>\n<p>\u3054\u89a7\u306e\u901a\u308a\u3001\u554f\u984c\u306a\u304f\u52d5\u4f5c\u3057\u3066\u304a\u308a\u3001\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3ID\u3092\u4f7f\u7528\u3057\u3066\u4e21\u65b9\u306e\u30c6\u30fc\u30d6\u30eb\u304b\u3089\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3067\u304d\u3066\u3044\u307e\u3059\u3002\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u305f\u3081\u306bHibernate\u304c\u5185\u90e8\u3067\u4f7f\u7528\u3057\u3066\u3044\u308bSQL\u3092\u78ba\u8a8d\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002\u305d\u308c\u306f\u4e21\u65b9\u306e\u30c6\u30fc\u30d6\u30eb\u304b\u3089\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u305f\u3081\u306b\u30b8\u30e7\u30a4\u30f3\u3092\u4f7f\u7528\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<h2>\u30ef\u30f3\u30c4\u30fc\u30ef\u30f3\u306e\u30de\u30c3\u30d4\u30f3\u30b0\u6ce8\u91c8\u306b\u3088\u308bHibernate\u306e1\u5bfe1\u306e\u95a2\u9023\u4ed8\u3051<\/h2>\n<p>\u4e0a\u8a18\u306e\u30bb\u30af\u30b7\u30e7\u30f3\u3067\u306f\u3001Hibernate\u306e1\u5bfe1\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u305f\u3081\u306eXML\u30d9\u30fc\u30b9\u306e\u8a2d\u5b9a\u65b9\u6cd5\u3092\u898b\u3066\u304d\u307e\u3057\u305f\u304c\u3001\u4eca\u5ea6\u306fJPA\u3068Hibernate\u306e\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u3092\u4f7f\u3063\u3066\u540c\u3058\u3053\u3068\u3092\u5b9f\u73fe\u3059\u308b\u65b9\u6cd5\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<h3>\u30cf\u30a4\u30d0\u30cd\u30fc\u30c8\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb<\/h3>\n<p>\u30cd\u30a4\u30c6\u30a3\u30d6\u306e\u65e5\u672c\u8a9e\u3067\u4ee5\u4e0b\u3092\u8a00\u3044\u63db\u3048\u307e\u3059\u30021\u3064\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u3060\u3051\u304c\u5fc5\u8981\u3067\u3059\u3002<br \/>\n\u300c\u30cf\u30a4\u30d0\u30cd\u30fc\u30c8\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3.cfg.xml\u300d<\/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.Txn1\"\/&gt;\r\n        &lt;mapping class=\"com.scdev.hibernate.model.Customer1\"\/&gt;\r\n    &lt;\/session-factory&gt;\r\n&lt;\/hibernate-configuration&gt;\r\n<\/code><\/pre>\n<p>\u30cf\u30a4\u30d0\u30cd\u30fc\u30c8\u306e\u8a2d\u5b9a\u306f\u30b7\u30f3\u30d7\u30eb\u3067\u3059\u3002\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u3092\u4f7f\u7528\u3059\u308b\uff12\u3064\u306e\u30e2\u30c7\u30eb\u30af\u30e9\u30b9\u3001Txn1\u3068Customer1\u3082\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<h3>Hibernate\u306e\u4e00\u5bfe\u4e00\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306e\u4f8b\u306e\u30e2\u30c7\u30eb\u30af\u30e9\u30b9<\/h3>\n<p>1\u3064\u305a\u3064\u306e\u30de\u30c3\u30d4\u30f3\u30b0\u6ce8\u91c8\u306e\u8a2d\u5b9a\u306b\u306f\u3001\u30cf\u30a4\u30d0\u30cd\u30fc\u30c8\u3067\u306f\u3001\u30e2\u30c7\u30eb\u30af\u30e9\u30b9\u304c\u6700\u3082\u91cd\u8981\u306a\u90e8\u5206\u3067\u3059\u3002\u3055\u3066\u3001\u30e2\u30c7\u30eb\u30af\u30e9\u30b9\u3092\u898b\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"post-pre\"><code>package com.scdev.hibernate.model;\r\n\r\nimport java.util.Date;\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=\"TRANSACTION\")\r\npublic class Txn1 {\r\n\r\n\t@Id\r\n\t@GeneratedValue(strategy=GenerationType.IDENTITY)\r\n\t@Column(name=\"txn_id\")\r\n\tprivate long id;\r\n\t\r\n\t@Column(name=\"txn_date\")\r\n\tprivate Date date;\r\n\t\r\n\t@Column(name=\"txn_total\")\r\n\tprivate double total;\r\n\t\r\n\t@OneToOne(mappedBy=\"txn\")\r\n\t@Cascade(value=org.hibernate.annotations.CascadeType.SAVE_UPDATE)\r\n\tprivate Customer1 customer;\r\n\t\r\n\t@Override\r\n\tpublic String toString(){\r\n\t\treturn id+\", \"+total+\", \"+customer.getName()+\", \"+customer.getEmail()+\", \"+customer.getAddress();\r\n\t}\r\n\r\n        \/\/Getter-Setter methods, omitted for clarity \r\n}\r\n<\/code><\/pre>\n<p>\u5927\u90e8\u5206\u306e\u6ce8\u91c8\u306fJava Persistence API\u306b\u7531\u6765\u3057\u3066\u3044\u308b\u70b9\u306b\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u3053\u308c\u306fHibernate\u304c\u305d\u306e\u5b9f\u88c5\u3092\u63d0\u4f9b\u3057\u3066\u3044\u308b\u304b\u3089\u3067\u3059\u3002\u305f\u3060\u3057\u3001\u30ab\u30b9\u30b1\u30fc\u30c9\u306b\u95a2\u3057\u3066\u306f\u3001Hibernate\u306e\u6ce8\u91c8\u3067\u3042\u308borg.hibernate.annotations.Cascade\u3068\u5217\u6319\u578b\u3067\u3042\u308borg.hibernate.annotations.CascadeType\u3092\u4f7f\u7528\u3059\u308b\u5fc5\u8981\u304c\u3042\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.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=\"CUSTOMER\")\r\npublic class Customer1 {\r\n\r\n\t@Id\r\n\t@Column(name=\"txn_id\", unique=true, nullable=false)\r\n\t@GeneratedValue(generator=\"gen\")\r\n\t@GenericGenerator(name=\"gen\", strategy=\"foreign\", parameters={@Parameter(name=\"property\", value=\"txn\")})\r\n\tprivate long id;\r\n\t\r\n\t@Column(name=\"cust_name\")\r\n\tprivate String name;\r\n\t\r\n\t@Column(name=\"cust_email\")\r\n\tprivate String email;\r\n\t\r\n\t@Column(name=\"cust_address\")\r\n\tprivate String address;\r\n\t\r\n\t@OneToOne\r\n\t@PrimaryKeyJoinColumn\r\n\tprivate Txn1 txn;\r\n\r\n        \/\/Getter-Setter methods\r\n}\r\n<\/code><\/pre>\n<p>id\u3092\u751f\u6210\u3059\u308b\u4ee3\u308f\u308a\u306b\u3001@GenericGenerator\u3092\u4f7f\u7528\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3053\u3068\u306b\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h3>\u30cd\u30a4\u30c6\u30a3\u30d6\u3067\u65e5\u672c\u8a9e\u306b\u8a00\u3044\u63db\u3048\u308b\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\uff08\u4e00\u3064\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u307f\uff09\uff1a<br \/>\nHibernate\u306e\u30bb\u30c3\u30b7\u30e7\u30f3\u30d5\u30a1\u30af\u30c8\u30ea\u30fc\u30e6\u30fc\u30c6\u30a3\u30ea\u30c6\u30a3\u30af\u30e9\u30b9<\/h3>\n<p>Hibernate\u306e\u30de\u30c3\u30d4\u30f3\u30b0\u3092\u63d0\u4f9b\u3059\u308b\u65b9\u6cd5\u306b\u4f9d\u5b58\u305b\u305a\u3001SessionFactory\u306e\u4f5c\u6210\u306f\u884c\u308f\u308c\u307e\u3059\u3002SessionFactory\u3092\u4f5c\u6210\u3059\u308b\u305f\u3081\u306e\u30e6\u30fc\u30c6\u30a3\u30ea\u30c6\u30a3\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.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 HibernateAnnotationUtil {\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-annotation.cfg.xml\r\n        \tConfiguration configuration = new Configuration();\r\n        \tconfiguration.configure(\"hibernate-annotation.cfg.xml\");\r\n        \tSystem.out.println(\"Hibernate Annotation Configuration loaded\");\r\n        \t\r\n        \tServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build();\r\n        \tSystem.out.println(\"Hibernate Annotation 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>\u30cd\u30a4\u30c6\u30a3\u30d6\u306a\u65e5\u672c\u8a9e\u3067\u4ee5\u4e0b\u3092\u8a00\u3044\u63db\u3048\u307e\u3059\u30021\u3064\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u69cb\u3044\u307e\u305b\u3093\uff1a<br \/>\nHibernate One to One\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u4f8b\u306b\u95a2\u3059\u308b\u30c6\u30b9\u30c8\u30d7\u30ed\u30b0\u30e9\u30e0<\/h3>\n<p>\u79c1\u305f\u3061\u306e\u30d2\u30d9\u30eb\u30cd\u30fc\u30c8\u306e\u30ef\u30f3\u30c4\u30fc\u30ef\u30f3\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u4f8b\u306b\u306f\u3001\u30b7\u30f3\u30d7\u30eb\u306a\u30c6\u30b9\u30c8\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>package com.scdev.hibernate.main;\r\n\r\nimport java.util.Date;\r\n\r\nimport org.hibernate.Session;\r\nimport org.hibernate.SessionFactory;\r\nimport org.hibernate.Transaction;\r\n\r\nimport com.scdev.hibernate.model.Customer1;\r\nimport com.scdev.hibernate.model.Txn1;\r\nimport com.scdev.hibernate.util.HibernateAnnotationUtil;\r\n\r\npublic class HibernateOneToOneAnnotationMain {\r\n\r\n\tpublic static void main(String[] args) {\r\n\t\t\r\n\t\tTxn1 txn = buildDemoTransaction();\r\n\t\t\r\n\t\tSessionFactory sessionFactory = null;\r\n\t\tSession session = null;\r\n\t\tTransaction tx = null;\r\n\t\ttry{\r\n\t\t\/\/Get Session\r\n\t\tsessionFactory = HibernateAnnotationUtil.getSessionFactory();\r\n\t\tsession = sessionFactory.getCurrentSession();\r\n\t\tSystem.out.println(\"Session created using annotations configuration\");\r\n\t\t\/\/start transaction\r\n\t\ttx = session.beginTransaction();\r\n\t\t\/\/Save the Model object\r\n\t\tsession.save(txn);\r\n\t\t\/\/Commit transaction\r\n\t\ttx.commit();\r\n\t\tSystem.out.println(\"Annotation Example. Transaction ID=\"+txn.getId());\r\n\t\t\r\n\t\t\/\/Get Saved Trasaction Data\r\n\t\tprintTransactionData(txn.getId(), sessionFactory);\r\n\t\t}catch(Exception e){\r\n\t\t\tSystem.out.println(\"Exception occured. \"+e.getMessage());\r\n\t\t\te.printStackTrace();\r\n\t\t}finally{\r\n\t\t\tif(sessionFactory != null &amp;&amp; !sessionFactory.isClosed()){\r\n\t\t\t\tSystem.out.println(\"Closing SessionFactory\");\r\n\t\t\t\tsessionFactory.close();\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tprivate static void printTransactionData(long id, SessionFactory sessionFactory) {\r\n\t\tSession session = null;\r\n\t\tTransaction tx = null;\r\n\t\ttry{\r\n\t\t\t\/\/Get Session\r\n\t\t\tsessionFactory = HibernateAnnotationUtil.getSessionFactory();\r\n\t\t\tsession = sessionFactory.getCurrentSession();\r\n\t\t\t\/\/start transaction\r\n\t\t\ttx = session.beginTransaction();\r\n\t\t\t\/\/Save the Model object\r\n\t\t\tTxn1 txn = (Txn1) session.get(Txn1.class, id);\r\n\t\t\t\/\/Commit transaction\r\n\t\t\ttx.commit();\r\n\t\t\tSystem.out.println(\"Annotation Example. Transaction Details=\\n\"+txn);\r\n\t\t\t\r\n\t\t\t}catch(Exception e){\r\n\t\t\t\tSystem.out.println(\"Exception occured. \"+e.getMessage());\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t}\r\n\r\n\tprivate static Txn1 buildDemoTransaction() {\r\n\t\tTxn1 txn = new Txn1();\r\n\t\ttxn.setDate(new Date());\r\n\t\ttxn.setTotal(100);\r\n\t\t\r\n\t\tCustomer1 cust = new Customer1();\r\n\t\tcust.setAddress(\"San Jose, USA\");\r\n\t\tcust.setEmail(\"scdev@yahoo.com\");\r\n\t\tcust.setName(\"Pankaj Kr\");\r\n\t\t\r\n\t\ttxn.setCustomer(cust);\r\n\t\t\r\n\t\tcust.setTxn(txn);\r\n\t\treturn txn;\r\n\t}\r\n\r\n}\r\n<\/code><\/pre>\n<p>\u4e0a\u8a18\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5b9f\u884c\u3057\u305f\u3068\u304d\u306e\u51fa\u529b\u30b9\u30cb\u30da\u30c3\u30c8\u3067\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>Hibernate Annotation Configuration loaded\r\nHibernate Annotation serviceRegistry created\r\nSession created using annotations configuration\r\nHibernate: insert into TRANSACTION (txn_date, txn_total) values (?, ?)\r\nHibernate: insert into CUSTOMER (cust_address, cust_email, cust_name, txn_id) values (?, ?, ?, ?)\r\nAnnotation Example. Transaction ID=20\r\nHibernate: select txn1x0_.txn_id as txn_id1_1_0_, txn1x0_.txn_date as txn_date2_1_0_, txn1x0_.txn_total as txn_tota3_1_0_, \r\ncustomer1x1_.txn_id as txn_id1_0_1_, customer1x1_.cust_address as cust_add2_0_1_, customer1x1_.cust_email as cust_ema3_0_1_, \r\ncustomer1x1_.cust_name as cust_nam4_0_1_ from TRANSACTION txn1x0_ left outer join CUSTOMER customer1x1_ on \r\ntxn1x0_.txn_id=customer1x1_.txn_id where txn1x0_.txn_id=?\r\nAnnotation Example. Transaction Details=\r\n20, 100.0, Pankaj Kr, scdev@yahoo.com, San Jose, USA\r\nClosing SessionFactory\r\n<\/code><\/pre>\n<p>\u51fa\u529b\u304c\u30cf\u30a4\u30d0\u30cd\u30fc\u30c8\u306e1\u5bfe1\u306eXML\u30d9\u30fc\u30b9\u306e\u8a2d\u5b9a\u306b\u4f3c\u3066\u3044\u308b\u3053\u3068\u306b\u6ce8\u76ee\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u30cf\u30a4\u30d0\u30cd\u30fc\u30c8\u306e1\u5bfe1\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u4f8b\u306f\u4ee5\u4e0a\u3067\u3059\u3002\u6700\u7d42\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\u306e\u3067\u3001\u8a66\u3057\u3066\u307f\u3066\u3055\u3089\u306b\u5b66\u3093\u3067\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>Hibernate\u306eOneToOne\u30de\u30c3\u30d4\u30f3\u30b0\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>\u4eca\u65e5\u306fHibernate\u306eOne to One\u30de\u30c3\u30d4\u30f3\u30b0\u3092\u898b\u3066\u3044\u304d\u307e\u3059\u3002\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u3068XML\u69cb\u6210\u3092\u4f7f\u7528\u3057\u305fHibernate\u306eOne to One\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u4f8b\u3092\u898b\u3066\u3044\u304d\u307e\u3059\u3002 \u30d2\u30d0\u30cd\u30a4\u30c8\u306b\u304a\u3051\u308b\u30ef\u30f3\u30fb\u30c8\u30a5\u30fb\u30ef\u30f3\u30fb\u30de\u30c3 [&hellip;]<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[26,61],"class_list":["post-490","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>\u30cd\u30a4\u30c6\u30a3\u30d6\u306a\u65e5\u672c\u8a9e\u3067\u4ee5\u4e0b\u306e\u5185\u5bb9\u3092\u8a00\u3044\u63db\u3048\u308b\u3068\u3001\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306b\u3088\u308bHibernate One to One\u306e\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u4f8b\u304c\u3042\u308a\u307e\u3059\u3002\u30d2\u30d9\u30eb\u30cd\u30fc\u30c8\u306eOne to One\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306e\u4f8b - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"\u30cd\u30a4\u30c6\u30a3\u30d6\u306a\u65e5\u672c\u8a9e\u3067\u4ee5\u4e0b\u306e\u5185\u5bb9\u3092\u8a00\u3044\u63db\u3048\u308b\u3068\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306b\u3088\u308bHibernate One to One\u306e\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u4f8b\u304c\u3042\u308a\u307e\u3059\u30d2\u30d9\u30eb\u30cd\u30fc\u30c8\u306eOne to One\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306e\u4f8b\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\/\u30cd\u30a4\u30c6\u30a3\u30d6\u306a\u65e5\u672c\u8a9e\u3067\u4ee5\u4e0b\u306e\u5185\u5bb9\u3092\u8a00\u3044\u63db\u3048\u308b\u3068\/\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u30cd\u30a4\u30c6\u30a3\u30d6\u306a\u65e5\u672c\u8a9e\u3067\u4ee5\u4e0b\u306e\u5185\u5bb9\u3092\u8a00\u3044\u63db\u3048\u308b\u3068\u3001\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306b\u3088\u308bHibernate One to One\u306e\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u4f8b\u304c\u3042\u308a\u307e\u3059\u3002\u30d2\u30d9\u30eb\u30cd\u30fc\u30c8\u306eOne to One\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306e\u4f8b\" \/>\n<meta property=\"og:description\" content=\"\u30cd\u30a4\u30c6\u30a3\u30d6\u306a\u65e5\u672c\u8a9e\u3067\u4ee5\u4e0b\u306e\u5185\u5bb9\u3092\u8a00\u3044\u63db\u3048\u308b\u3068\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306b\u3088\u308bHibernate One to One\u306e\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u4f8b\u304c\u3042\u308a\u307e\u3059\u30d2\u30d9\u30eb\u30cd\u30fc\u30c8\u306eOne to One\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306e\u4f8b\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\/\u30cd\u30a4\u30c6\u30a3\u30d6\u306a\u65e5\u672c\u8a9e\u3067\u4ee5\u4e0b\u306e\u5185\u5bb9\u3092\u8a00\u3044\u63db\u3048\u308b\u3068\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-09-05T12:54:23+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-07-31T14:59:30+00:00\" \/>\n<meta name=\"author\" content=\"\u82bd\u4f9d, \u96e8\u591c\" \/>\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=\"\u82bd\u4f9d, \u96e8\u591c\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"46\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\/%e3%83%8d%e3%82%a4%e3%83%86%e3%82%a3%e3%83%96%e3%81%aa%e6%97%a5%e6%9c%ac%e8%aa%9e%e3%81%a7%e4%bb%a5%e4%b8%8b%e3%81%ae%e5%86%85%e5%ae%b9%e3%82%92%e8%a8%80%e3%81%84%e6%8f%9b%e3%81%88%e3%82%8b%e3%81%a8\/\",\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/%e3%83%8d%e3%82%a4%e3%83%86%e3%82%a3%e3%83%96%e3%81%aa%e6%97%a5%e6%9c%ac%e8%aa%9e%e3%81%a7%e4%bb%a5%e4%b8%8b%e3%81%ae%e5%86%85%e5%ae%b9%e3%82%92%e8%a8%80%e3%81%84%e6%8f%9b%e3%81%88%e3%82%8b%e3%81%a8\/\",\"name\":\"\u30cd\u30a4\u30c6\u30a3\u30d6\u306a\u65e5\u672c\u8a9e\u3067\u4ee5\u4e0b\u306e\u5185\u5bb9\u3092\u8a00\u3044\u63db\u3048\u308b\u3068\u3001\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306b\u3088\u308bHibernate One to One\u306e\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u4f8b\u304c\u3042\u308a\u307e\u3059\u3002\u30d2\u30d9\u30eb\u30cd\u30fc\u30c8\u306eOne to One\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306e\u4f8b - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#website\"},\"datePublished\":\"2023-09-05T12:54:23+00:00\",\"dateModified\":\"2025-07-31T14:59:30+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/aeb60a7861f2f002b54c66bd65bc6c27\"},\"description\":\"\u30cd\u30a4\u30c6\u30a3\u30d6\u306a\u65e5\u672c\u8a9e\u3067\u4ee5\u4e0b\u306e\u5185\u5bb9\u3092\u8a00\u3044\u63db\u3048\u308b\u3068\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306b\u3088\u308bHibernate One to One\u306e\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u4f8b\u304c\u3042\u308a\u307e\u3059\u30d2\u30d9\u30eb\u30cd\u30fc\u30c8\u306eOne to One\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306e\u4f8b\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\/%e3%83%8d%e3%82%a4%e3%83%86%e3%82%a3%e3%83%96%e3%81%aa%e6%97%a5%e6%9c%ac%e8%aa%9e%e3%81%a7%e4%bb%a5%e4%b8%8b%e3%81%ae%e5%86%85%e5%ae%b9%e3%82%92%e8%a8%80%e3%81%84%e6%8f%9b%e3%81%88%e3%82%8b%e3%81%a8\/#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/ja\/blog\/%e3%83%8d%e3%82%a4%e3%83%86%e3%82%a3%e3%83%96%e3%81%aa%e6%97%a5%e6%9c%ac%e8%aa%9e%e3%81%a7%e4%bb%a5%e4%b8%8b%e3%81%ae%e5%86%85%e5%ae%b9%e3%82%92%e8%a8%80%e3%81%84%e6%8f%9b%e3%81%88%e3%82%8b%e3%81%a8\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/%e3%83%8d%e3%82%a4%e3%83%86%e3%82%a3%e3%83%96%e3%81%aa%e6%97%a5%e6%9c%ac%e8%aa%9e%e3%81%a7%e4%bb%a5%e4%b8%8b%e3%81%ae%e5%86%85%e5%ae%b9%e3%82%92%e8%a8%80%e3%81%84%e6%8f%9b%e3%81%88%e3%82%8b%e3%81%a8\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/ja\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u30cd\u30a4\u30c6\u30a3\u30d6\u306a\u65e5\u672c\u8a9e\u3067\u4ee5\u4e0b\u306e\u5185\u5bb9\u3092\u8a00\u3044\u63db\u3048\u308b\u3068\u3001\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306b\u3088\u308bHibernate One to One\u306e\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u4f8b\u304c\u3042\u308a\u307e\u3059\u3002\u30d2\u30d9\u30eb\u30cd\u30fc\u30c8\u306eOne to One\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306e\u4f8b\"}]},{\"@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\/aeb60a7861f2f002b54c66bd65bc6c27\",\"name\":\"\u82bd\u4f9d, \u96e8\u591c\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6305fe5cabc2b854c1208975a47fbf3f8cef3f7cd775b94dceedbe59b74a8010?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6305fe5cabc2b854c1208975a47fbf3f8cef3f7cd775b94dceedbe59b74a8010?s=96&d=mm&r=g\",\"caption\":\"\u82bd\u4f9d, \u96e8\u591c\"},\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/author\/meiamaya\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/%e3%83%8d%e3%82%a4%e3%83%86%e3%82%a3%e3%83%96%e3%81%aa%e6%97%a5%e6%9c%ac%e8%aa%9e%e3%81%a7%e4%bb%a5%e4%b8%8b%e3%81%ae%e5%86%85%e5%ae%b9%e3%82%92%e8%a8%80%e3%81%84%e6%8f%9b%e3%81%88%e3%82%8b%e3%81%a8\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u30cd\u30a4\u30c6\u30a3\u30d6\u306a\u65e5\u672c\u8a9e\u3067\u4ee5\u4e0b\u306e\u5185\u5bb9\u3092\u8a00\u3044\u63db\u3048\u308b\u3068\u3001\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306b\u3088\u308bHibernate One to One\u306e\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u4f8b\u304c\u3042\u308a\u307e\u3059\u3002\u30d2\u30d9\u30eb\u30cd\u30fc\u30c8\u306eOne to One\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306e\u4f8b - Blog - Silicon Cloud","description":"\u30cd\u30a4\u30c6\u30a3\u30d6\u306a\u65e5\u672c\u8a9e\u3067\u4ee5\u4e0b\u306e\u5185\u5bb9\u3092\u8a00\u3044\u63db\u3048\u308b\u3068\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306b\u3088\u308bHibernate One to One\u306e\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u4f8b\u304c\u3042\u308a\u307e\u3059\u30d2\u30d9\u30eb\u30cd\u30fc\u30c8\u306eOne to One\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306e\u4f8b\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\/\u30cd\u30a4\u30c6\u30a3\u30d6\u306a\u65e5\u672c\u8a9e\u3067\u4ee5\u4e0b\u306e\u5185\u5bb9\u3092\u8a00\u3044\u63db\u3048\u308b\u3068\/","og_locale":"ja_JP","og_type":"article","og_title":"\u30cd\u30a4\u30c6\u30a3\u30d6\u306a\u65e5\u672c\u8a9e\u3067\u4ee5\u4e0b\u306e\u5185\u5bb9\u3092\u8a00\u3044\u63db\u3048\u308b\u3068\u3001\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306b\u3088\u308bHibernate One to One\u306e\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u4f8b\u304c\u3042\u308a\u307e\u3059\u3002\u30d2\u30d9\u30eb\u30cd\u30fc\u30c8\u306eOne to One\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306e\u4f8b","og_description":"\u30cd\u30a4\u30c6\u30a3\u30d6\u306a\u65e5\u672c\u8a9e\u3067\u4ee5\u4e0b\u306e\u5185\u5bb9\u3092\u8a00\u3044\u63db\u3048\u308b\u3068\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306b\u3088\u308bHibernate One to One\u306e\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u4f8b\u304c\u3042\u308a\u307e\u3059\u30d2\u30d9\u30eb\u30cd\u30fc\u30c8\u306eOne to One\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306e\u4f8b\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\/\u30cd\u30a4\u30c6\u30a3\u30d6\u306a\u65e5\u672c\u8a9e\u3067\u4ee5\u4e0b\u306e\u5185\u5bb9\u3092\u8a00\u3044\u63db\u3048\u308b\u3068\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-09-05T12:54:23+00:00","article_modified_time":"2025-07-31T14:59:30+00:00","author":"\u82bd\u4f9d, \u96e8\u591c","twitter_card":"summary_large_image","twitter_misc":{"\u57f7\u7b46\u8005":"\u82bd\u4f9d, \u96e8\u591c","\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593":"46\u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/ja\/blog\/%e3%83%8d%e3%82%a4%e3%83%86%e3%82%a3%e3%83%96%e3%81%aa%e6%97%a5%e6%9c%ac%e8%aa%9e%e3%81%a7%e4%bb%a5%e4%b8%8b%e3%81%ae%e5%86%85%e5%ae%b9%e3%82%92%e8%a8%80%e3%81%84%e6%8f%9b%e3%81%88%e3%82%8b%e3%81%a8\/","url":"https:\/\/www.silicloud.com\/ja\/blog\/%e3%83%8d%e3%82%a4%e3%83%86%e3%82%a3%e3%83%96%e3%81%aa%e6%97%a5%e6%9c%ac%e8%aa%9e%e3%81%a7%e4%bb%a5%e4%b8%8b%e3%81%ae%e5%86%85%e5%ae%b9%e3%82%92%e8%a8%80%e3%81%84%e6%8f%9b%e3%81%88%e3%82%8b%e3%81%a8\/","name":"\u30cd\u30a4\u30c6\u30a3\u30d6\u306a\u65e5\u672c\u8a9e\u3067\u4ee5\u4e0b\u306e\u5185\u5bb9\u3092\u8a00\u3044\u63db\u3048\u308b\u3068\u3001\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306b\u3088\u308bHibernate One to One\u306e\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u4f8b\u304c\u3042\u308a\u307e\u3059\u3002\u30d2\u30d9\u30eb\u30cd\u30fc\u30c8\u306eOne to One\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306e\u4f8b - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#website"},"datePublished":"2023-09-05T12:54:23+00:00","dateModified":"2025-07-31T14:59:30+00:00","author":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/aeb60a7861f2f002b54c66bd65bc6c27"},"description":"\u30cd\u30a4\u30c6\u30a3\u30d6\u306a\u65e5\u672c\u8a9e\u3067\u4ee5\u4e0b\u306e\u5185\u5bb9\u3092\u8a00\u3044\u63db\u3048\u308b\u3068\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306b\u3088\u308bHibernate One to One\u306e\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u4f8b\u304c\u3042\u308a\u307e\u3059\u30d2\u30d9\u30eb\u30cd\u30fc\u30c8\u306eOne to One\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306e\u4f8b\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\/%e3%83%8d%e3%82%a4%e3%83%86%e3%82%a3%e3%83%96%e3%81%aa%e6%97%a5%e6%9c%ac%e8%aa%9e%e3%81%a7%e4%bb%a5%e4%b8%8b%e3%81%ae%e5%86%85%e5%ae%b9%e3%82%92%e8%a8%80%e3%81%84%e6%8f%9b%e3%81%88%e3%82%8b%e3%81%a8\/#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/ja\/blog\/%e3%83%8d%e3%82%a4%e3%83%86%e3%82%a3%e3%83%96%e3%81%aa%e6%97%a5%e6%9c%ac%e8%aa%9e%e3%81%a7%e4%bb%a5%e4%b8%8b%e3%81%ae%e5%86%85%e5%ae%b9%e3%82%92%e8%a8%80%e3%81%84%e6%8f%9b%e3%81%88%e3%82%8b%e3%81%a8\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/ja\/blog\/%e3%83%8d%e3%82%a4%e3%83%86%e3%82%a3%e3%83%96%e3%81%aa%e6%97%a5%e6%9c%ac%e8%aa%9e%e3%81%a7%e4%bb%a5%e4%b8%8b%e3%81%ae%e5%86%85%e5%ae%b9%e3%82%92%e8%a8%80%e3%81%84%e6%8f%9b%e3%81%88%e3%82%8b%e3%81%a8\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/ja\/blog\/"},{"@type":"ListItem","position":2,"name":"\u30cd\u30a4\u30c6\u30a3\u30d6\u306a\u65e5\u672c\u8a9e\u3067\u4ee5\u4e0b\u306e\u5185\u5bb9\u3092\u8a00\u3044\u63db\u3048\u308b\u3068\u3001\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306b\u3088\u308bHibernate One to One\u306e\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u4f8b\u304c\u3042\u308a\u307e\u3059\u3002\u30d2\u30d9\u30eb\u30cd\u30fc\u30c8\u306eOne to One\u30de\u30c3\u30d4\u30f3\u30b0\u306e\u30a2\u30ce\u30c6\u30fc\u30b7\u30e7\u30f3\u306e\u4f8b"}]},{"@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\/aeb60a7861f2f002b54c66bd65bc6c27","name":"\u82bd\u4f9d, \u96e8\u591c","image":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6305fe5cabc2b854c1208975a47fbf3f8cef3f7cd775b94dceedbe59b74a8010?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6305fe5cabc2b854c1208975a47fbf3f8cef3f7cd775b94dceedbe59b74a8010?s=96&d=mm&r=g","caption":"\u82bd\u4f9d, \u96e8\u591c"},"url":"https:\/\/www.silicloud.com\/ja\/blog\/author\/meiamaya\/"},{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/%e3%83%8d%e3%82%a4%e3%83%86%e3%82%a3%e3%83%96%e3%81%aa%e6%97%a5%e6%9c%ac%e8%aa%9e%e3%81%a7%e4%bb%a5%e4%b8%8b%e3%81%ae%e5%86%85%e5%ae%b9%e3%82%92%e8%a8%80%e3%81%84%e6%8f%9b%e3%81%88%e3%82%8b%e3%81%a8\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/490","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\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/comments?post=490"}],"version-history":[{"count":1,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/490\/revisions"}],"predecessor-version":[{"id":41287,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/490\/revisions\/41287"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/media?parent=490"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/categories?post=490"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/tags?post=490"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}