{"id":7180,"date":"2024-11-14T15:23:20","date_gmt":"2024-11-14T07:23:20","guid":{"rendered":"https:\/\/fwq.ai\/blog\/7180\/"},"modified":"2024-11-14T15:23:20","modified_gmt":"2024-11-14T07:23:20","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:\/\/fwq.ai\/blog\/7180\/","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><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173059616024006.jpg\" class=\"aligncenter\" title=\"\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\u63d2\u56fe\" alt=\"\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\u63d2\u56fe\" \/><\/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<p>  \u767b\u5f55\u540e\u590d\u5236    <\/p>\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>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\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>\u4ee5\u4e0a\u5c31\u662f\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\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>jpa\u67e5\u8be2\u51fa\u7684\u540c\u4e00\u5bf9\u8c61\u662f\u5426\u4fdd\u6301\u5185\u5b58\u4e00\u81f4\u6027 \u95ee\u9898\u63cf\u8ff0 \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 \u539f\u56e0\u5206\u6790 \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 \u76f8\u5173\u4ee3\u7801 public wmslasttime getlasttime(int synctype) { return wmslasttimedao.findfirstbysynctypeorderbylasttime(synctype); } \u767b\u5f55\u540e\u590d\u5236 WmsLastTime wmsLastTime = wmsLastTimeService.getLastTime(0); wmsLastTime.setOrderNo(&#8220;1111&#8221;); WmsLastTime wmsLastTime1 = wmsLastTimeService.getLastTime(0); wmsLastTime1.setOrderNo(&#8220;2222&#8221;); \u767b\u5f55\u540e\u590d\u5236 \u9884\u671f\u7ed3\u679c \u671f\u671b\u7ed3\u679c\u662fwmslasttime\u7684orderno\u4e3a1111\uff0cwmslasttime1\u7684orderno\u4e3a2222\u3002 \u5b9e\u9645\u7ed3\u679c \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 \u4ee5\u4e0a\u5c31\u662f\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\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-7180","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7180","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=7180"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7180\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=7180"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=7180"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=7180"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}