{"id":200389,"date":"2025-05-06T12:36:18","date_gmt":"2025-05-06T04:36:18","guid":{"rendered":"https:\/\/server.hk\/cnblog\/200389\/"},"modified":"2025-05-06T12:36:18","modified_gmt":"2025-05-06T04:36:18","slug":"%e4%bd%bf%e7%94%a8jpa%e6%9f%a5%e8%af%a2%e5%90%8c%e4%b8%80%e5%af%b9%e8%b1%a1%ef%bc%8c%e4%bf%ae%e6%94%b9%e5%80%bc%e5%90%8e%e5%86%8d%e6%ac%a1%e6%9f%a5%e8%af%a2%e4%b8%ba%e4%bd%95%e4%bc%9a%e5%be%97","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/200389\/","title":{"rendered":"\u4f7f\u7528JPA\u67e5\u8be2\u540c\u4e00\u5bf9\u8c61\uff0c\u4fee\u6539\u503c\u540e\u518d\u6b21\u67e5\u8be2\u4e3a\u4f55\u4f1a\u5f97\u5230\u66f4\u65b0\u540e\u7684\u503c\uff1f"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>\u4f7f\u7528JPA\u67e5\u8be2\u540c\u4e00\u5bf9\u8c61\uff0c\u4fee\u6539\u503c\u540e\u518d\u6b21\u67e5\u8be2\u4e3a\u4f55\u4f1a\u5f97\u5230\u66f4\u65b0\u540e\u7684\u503c\uff1f<\/h1>\n<p>\u5728\u6570\u636e\u5e93\u5b9e\u6218\u5f00\u53d1\u7684\u8fc7\u7a0b\u4e2d\uff0c\u6211\u4eec\u7ecf\u5e38\u4f1a\u9047\u5230\u4e00\u4e9b\u8fd9\u6837\u90a3\u6837\u7684\u95ee\u9898\uff0c\u7136\u540e\u8981\u5361\u597d\u534a\u5929\uff0c\u7b49\u95ee\u9898\u89e3\u51b3\u4e86\u624d\u53d1\u73b0\u539f\u6765\u4e00\u4e9b\u7ec6\u8282\u77e5\u8bc6\u70b9\u8fd8\u662f\u6ca1\u6709\u638c\u63e1\u597d\u3002\u4eca\u5929\u4e3b\u673a\u5b9d\u8d1d\u5c31\u6574\u7406\u5206\u4eab\u300a\u4f7f\u7528JPA\u67e5\u8be2\u540c\u4e00\u5bf9\u8c61\uff0c\u4fee\u6539\u503c\u540e\u518d\u6b21\u67e5\u8be2\u4e3a\u4f55\u4f1a\u5f97\u5230\u66f4\u65b0\u540e\u7684\u503c\uff1f\u300b\uff0c\u804a\u804a\uff0c\u5e0c\u671b\u53ef\u4ee5\u5e2e\u52a9\u5230\u6b63\u5728\u52aa\u529b\u8d5a\u94b1\u7684\u4f60\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241103\/173064117067277d12d8920.jpg\" class=\"aligncenter\"><\/p>\n<p><strong>jpa\u67e5\u8be2\u51fa\u7684\u540c\u4e00\u5bf9\u8c61\u662f\u5426\u4fdd\u6301\u5185\u5b58\u4e00\u81f4\u6027<\/strong><\/p>\n<p><strong>\u95ee\u9898\u63cf\u8ff0<\/strong><\/p>\n<p>\u5728java\u4e2d\u4f7f\u7528jpa\u67e5\u8be2\u51fa\u6570\u636e\u5e93\u7684\u4e00\u6761\u8bb0\u5f55\u540e\uff0c\u4fee\u6539\u5176\u503c\u800c\u4e0d\u4fdd\u5b58\u3002\u518d\u6b21\u8c03\u7528jpa\u67e5\u8be2\u51fa\u540c\u4e00\u8bb0\u5f55\u65f6\uff0c\u53d1\u73b0\u8be5\u8bb0\u5f55\u7684\u503c\u5df2\u66f4\u65b0\u4e3a\u4fee\u6539\u540e\u7684\u503c\uff0c\u800c\u975e\u6570\u636e\u5e93\u4e2d\u7684\u65e7\u503c\u3002<\/p>\n<p><strong>\u539f\u56e0\u5206\u6790<\/strong><\/p>\n<p>\u4e0a\u8ff0\u73b0\u8c61\u6e90\u4e8ejava persistence api\uff08jpa\uff09\u7684\u4e00\u7ea7\u7f13\u5b58\u673a\u5236\u3002\u5f53\u6267\u884c\u7b2c\u4e00\u6b21jpa\u67e5\u8be2\u65f6\uff0c\u67e5\u8be2\u7ed3\u679c\u4f1a\u7f13\u5b58\u5728\u79f0\u4e3a\u4e00\u7ea7\u7f13\u5b58\u7684\u4e34\u65f6\u5b58\u50a8\u533a\u57df\u4e2d\u3002 subsequent\u67e5\u8be2\u53ef\u4ee5\u76f4\u63a5\u4ece\u7f13\u5b58\u4e2d\u83b7\u53d6\u6570\u636e\uff0c\u800c\u65e0\u9700\u518d\u8bbf\u95ee\u6570\u636e\u5e93\u3002\u5728\u4ee5\u4e0b\u793a\u4f8b\u4e2d\uff0cwmslasttime\u548cwmslasttime1\u90fd\u6307\u5411\u540c\u4e00\u7f13\u5b58\u5bf9\u8c61\uff0c\u56e0\u6b64\u4fee\u6539\u5176\u503c\u5c06\u5f71\u54cd\u540c\u4e00\u5b9e\u4f53\u7684\u4e0d\u540c\u5f15\u7528\u3002<\/p>\n<p><strong>\u76f8\u5173\u4ee3\u7801<\/strong><\/p>\n<pre>public wmslasttime getlasttime(int synctype) {\n    return wmslasttimedao.findfirstbysynctypeorderbylasttime(synctype);\n}<\/pre>\n<pre>    WmsLastTime wmsLastTime = wmsLastTimeService.getLastTime(0);\n    wmsLastTime.setOrderNo(\"1111\");\n\n    WmsLastTime wmsLastTime1 = wmsLastTimeService.getLastTime(0);\n    wmsLastTime1.setOrderNo(\"2222\");<\/pre>\n<p><strong>\u9884\u671f\u7ed3\u679c<\/strong><\/p>\n<p>\u671f\u671b\u7ed3\u679c\u662fwmslasttime\u7684orderno\u4e3a1111\uff0cwmslasttime1\u7684orderno\u4e3a2222\u3002<\/p>\n<p><strong>\u5b9e\u9645\u7ed3\u679c<\/strong><\/p>\n<p>\u5b9e\u9645\u7ed3\u679c\u662fwmslasttime\u548cwmslasttime1\u7684orderno\u90fd\u4e3a2222\uff0c\u56e0\u4e3a\u5b83\u4eec\u6307\u5411\u540c\u4e00\u4e8c\u7ea7\u7f13\u5b58\u5bf9\u8c61\u3002<\/p>\n<p>\u672c\u7bc7\u5173\u4e8e\u300a\u4f7f\u7528JPA\u67e5\u8be2\u540c\u4e00\u5bf9\u8c61\uff0c\u4fee\u6539\u503c\u540e\u518d\u6b21\u67e5\u8be2\u4e3a\u4f55\u4f1a\u5f97\u5230\u66f4\u65b0\u540e\u7684\u503c\uff1f\u300b\u7684\u4ecb\u7ecd\u5c31\u5230\u6b64\u7ed3\u675f\u5566\uff0c\u4f46\u662f\u5b66\u65e0\u6b62\u5883\uff0c\u60f3\u8981\u4e86\u89e3\u5b66\u4e60\u66f4\u591a\u5173\u4e8e\u6570\u636e\u5e93\u7684\u76f8\u5173\u77e5\u8bc6\uff0c\u8bf7\u5173\u6ce8\u4e3b\u673a\u5b9d\u8d1d\u516c\u4f17\u53f7\uff01<\/p>\n<dl>\n<dt>\n <\/dt>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528JPA\u67e5\u8be2\u540c\u4e00\u5bf9\u8c61\uff0c\u4fee\u6539\u503c\u540e&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-200389","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/200389","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=200389"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/200389\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=200389"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=200389"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=200389"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}