{"id":8502,"date":"2023-11-28T20:29:53","date_gmt":"2023-11-28T12:29:53","guid":{"rendered":"https:\/\/wx.kaifamiao.info\/?p=8502"},"modified":"2023-12-06T10:37:59","modified_gmt":"2023-12-06T02:37:59","slug":"springboot-zhong-jpa-he-hibernate-you-na-xie-qu-bi","status":"publish","type":"post","link":"http:\/\/wx.kaifamiao.info\/index.php\/2023\/11\/28\/springboot-zhong-jpa-he-hibernate-you-na-xie-qu-bi\/","title":{"rendered":"SpringBoot \u4e2d JPA \u548c Hibernate \u6709\u54ea\u4e9b\u533a\u522b\uff1f"},"content":{"rendered":"<p>\u5728 Spring Boot \u4e2d\uff0cJPA\uff08Java Persistence API\uff09\u548c Hibernate \u90fd\u662f\u7528\u4e8e\u5b9e\u73b0\u6301\u4e45\u5c42\u7684\u6846\u67b6\u3002\u4e0b\u9762\u662f\u5b83\u4eec\u4e4b\u95f4\u7684\u4e00\u4e9b\u533a\u522b\uff1a<\/p>\n<ol>\n<li>\n<strong>\u5b9a\u4e49\uff1a<\/strong><\/p>\n<ul>\n<li><strong>JPA\uff1a<\/strong> JPA \u662f Java EE \u7684\u4e00\u90e8\u5206\uff0c\u662f\u4e00\u79cd\u89c4\u8303\u6216\u63a5\u53e3\uff0c\u5b9a\u4e49\u4e86\u4e00\u7cfb\u5217\u7528\u4e8e\u7ba1\u7406 Java \u5bf9\u8c61\u4e0e\u5173\u7cfb\u6570\u636e\u5e93\u4e4b\u95f4\u6620\u5c04\u7684\u6807\u51c6\u3002JPA \u63d0\u4f9b\u4e86\u4e00\u79cd\u4f7f\u7528\u5bf9\u8c61\u6765\u8868\u793a\u6570\u636e\u5e93\u8868\u3001\u5b9e\u73b0\u5bf9\u8c61\u5173\u7cfb\u6620\u5c04\uff08ORM\uff09\u7684\u65b9\u5f0f\u3002<\/li>\n<li><strong>Hibernate\uff1a<\/strong> Hibernate \u662f\u4e00\u4e2a\u5b9e\u73b0\u4e86 JPA \u89c4\u8303\u7684 ORM \u6846\u67b6\u3002\u5b83\u5b9e\u9645\u4e0a\u662f\u4e00\u4e2a\u5b8c\u6574\u7684\u6301\u4e45\u6027\u6846\u67b6\uff0c\u4e0d\u4ec5\u4ec5\u5b9e\u73b0\u4e86 JPA \u6807\u51c6\uff0c\u8fd8\u63d0\u4f9b\u4e86\u81ea\u5df1\u7684\u4e00\u4e9b\u6269\u5c55\u548c\u529f\u80fd\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>\u6807\u51c6 vs. \u5b9e\u73b0\uff1a<\/strong><\/p>\n<ul>\n<li><strong>JPA\uff1a<\/strong> JPA \u662f\u4e00\u79cd\u89c4\u8303\uff0c\u63d0\u4f9b\u4e86\u63a5\u53e3\u548c\u6807\u51c6\uff0c\u4f46\u6ca1\u6709\u63d0\u4f9b\u5177\u4f53\u7684\u5b9e\u73b0\u3002\u5f00\u53d1\u8005\u53ef\u4ee5\u9009\u62e9\u4f7f\u7528\u4efb\u4f55\u7b26\u5408 JPA \u89c4\u8303\u7684\u5b9e\u73b0\uff0c\u6bd4\u5982 Hibernate\u3001EclipseLink\u3001OpenJPA \u7b49\u3002<\/li>\n<li><strong>Hibernate\uff1a<\/strong> Hibernate \u662f JPA \u7684\u4e00\u79cd\u5b9e\u73b0\uff0c\u540c\u65f6\u4e5f\u63d0\u4f9b\u4e86\u81ea\u5df1\u7684\u4e00\u4e9b\u7279\u6027\u548c\u529f\u80fd\u3002\u867d\u7136 Hibernate \u662f JPA \u7684\u5b9e\u73b0\u4e4b\u4e00\uff0c\u4f46\u5b83\u5e76\u4e0d\u4ec5\u9650\u4e8e JPA \u7684\u529f\u80fd\uff0c\u8fd8\u63d0\u4f9b\u4e86\u4e00\u4e9b\u72ec\u6709\u7684\u7279\u6027\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>\u914d\u7f6e\uff1a<\/strong><\/p>\n<ul>\n<li><strong>JPA\uff1a<\/strong> JPA \u662f\u4e00\u79cd\u89c4\u8303\uff0c\u56e0\u6b64\u4f7f\u7528 JPA \u65f6\uff0c\u9700\u8981\u5728\u9879\u76ee\u4e2d\u5f15\u5165 JPA \u7684\u4f9d\u8d56\uff0c\u4f46\u540c\u65f6\u8fd8\u9700\u8981\u9009\u62e9\u5e76\u5f15\u5165\u4e00\u4e2a\u7b26\u5408 JPA \u89c4\u8303\u7684\u5177\u4f53\u5b9e\u73b0\uff0c\u6bd4\u5982 Hibernate\u3002<\/li>\n<li><strong>Hibernate\uff1a<\/strong> \u5982\u679c\u9009\u62e9\u4f7f\u7528 Hibernate\uff0c\u901a\u5e38\u53ea\u9700\u8981\u5728\u9879\u76ee\u4e2d\u5f15\u5165 Hibernate \u7684\u76f8\u5173\u4f9d\u8d56\u5373\u53ef\uff0c\u4e0d\u9700\u8981\u989d\u5916\u5f15\u5165 JPA \u7684\u4f9d\u8d56\uff0c\u56e0\u4e3a Hibernate \u672c\u8eab\u5c31\u5305\u542b\u4e86\u5bf9 JPA \u89c4\u8303\u7684\u5b9e\u73b0\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<strong>\u5b66\u4e60\u66f2\u7ebf\uff1a<\/strong><\/p>\n<ul>\n<li><strong>JPA\uff1a<\/strong> JPA \u63d0\u4f9b\u4e86\u4e00\u79cd\u6807\u51c6\u5316\u7684\u65b9\u5f0f\u6765\u8fdb\u884c\u6570\u636e\u5e93\u8bbf\u95ee\uff0c\u8fd9\u610f\u5473\u7740\u5982\u679c\u4f60\u5c06\u6765\u51b3\u5b9a\u66f4\u6362\u5e95\u5c42\u7684 JPA \u5b9e\u73b0\uff0c\u4f60\u7684\u4ee3\u7801\u5e94\u8be5\u662f\u53ef\u79fb\u690d\u7684\u3002\u5b66\u4e60 JPA \u53ef\u80fd\u4f1a\u9700\u8981\u66f4\u591a\u7684\u65f6\u95f4\uff0c\u56e0\u4e3a\u5b83\u662f\u4e00\u79cd\u89c4\u8303\uff0c\u800c\u4e0d\u662f\u5177\u4f53\u7684\u5b9e\u73b0\u3002<\/li>\n<li><strong>Hibernate\uff1a<\/strong> Hibernate \u63d0\u4f9b\u4e86\u66f4\u591a\u7684\u529f\u80fd\u548c\u9009\u9879\uff0c\u4f46\u8fd9\u4e5f\u610f\u5473\u7740\u5b66\u4e60\u66f2\u7ebf\u53ef\u80fd\u4f1a\u76f8\u5bf9\u8f83\u9ad8\u3002Hibernate \u7684\u5f3a\u5927\u529f\u80fd\u4f7f\u5f97\u5b83\u6210\u4e3a\u8bb8\u591a\u5f00\u53d1\u8005\u7684\u9996\u9009\uff0c\u5c24\u5176\u662f\u5728\u9700\u8981\u4f7f\u7528\u590d\u6742 ORM \u7279\u6027\u65f6\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>\u603b\u4f53\u800c\u8a00\uff0cJPA \u63d0\u4f9b\u4e86\u4e00\u79cd\u6807\u51c6\u7684\u3001\u89c4\u8303\u5316\u7684\u6301\u4e45\u6027\u7f16\u7a0b\u6a21\u578b\uff0c\u800c Hibernate \u63d0\u4f9b\u4e86\u66f4\u591a\u7684\u529f\u80fd\u548c\u7075\u6d3b\u6027\u3002\u5728\u9009\u62e9\u4f7f\u7528 JPA \u8fd8\u662f Hibernate \u65f6\uff0c\u53ef\u4ee5\u6839\u636e\u9879\u76ee\u7684\u9700\u6c42\u3001\u5f00\u53d1\u8005\u7684\u7ecf\u9a8c\u548c\u56e2\u961f\u7684\u504f\u597d\u6765\u505a\u51fa\u51b3\u7b56\u3002\u5728 Spring Boot \u4e2d\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u5f88\u5bb9\u6613\u5730\u96c6\u6210 Hibernate \u4f5c\u4e3a JPA \u7684\u5b9e\u73b0\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 Spring Boot \u4e2d\uff0cJPA\uff08Java Persistence API\uff09\u548c Hibernate \u90fd\u662f [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[100],"tags":[],"class_list":["post-8502","post","type-post","status-publish","format-standard","hentry","category-springboot"],"_links":{"self":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/8502","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/comments?post=8502"}],"version-history":[{"count":2,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/8502\/revisions"}],"predecessor-version":[{"id":16623,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/8502\/revisions\/16623"}],"wp:attachment":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/media?parent=8502"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/categories?post=8502"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/tags?post=8502"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}