{"id":1011,"date":"2010-10-02T00:34:26","date_gmt":"2010-10-02T00:34:26","guid":{"rendered":"http:\/\/enjoyasp.net\/?p=1011"},"modified":"2010-10-02T00:34:26","modified_gmt":"2010-10-02T00:34:26","slug":"insert%e6%97%b6%e6%a3%80%e6%9f%a5%e9%87%8d%e5%a4%8d%e5%80%bc","status":"publish","type":"post","link":"https:\/\/enjoyasp.net\/index.php\/2010\/10\/02\/insert%e6%97%b6%e6%a3%80%e6%9f%a5%e9%87%8d%e5%a4%8d%e5%80%bc\/","title":{"rendered":"insert\u65f6\u68c0\u67e5\u91cd\u590d\u503c"},"content":{"rendered":"<p>Spring\u63d0\u4f9b\u4e86\u4e00\u4e2a \u6570\u636e\u5b8c\u6574\u6027\u5f02\u5e38\uff0c\u5f53\u8fdb\u884cinsert\u64cd\u4f5c\u65f6\uff0c\u82e5\u6570\u636e\u5e93\u4e2d\u5df2\u5b58\u5728\u6b64\u8bb0\u5f55\uff08\u4e3b\u952e\u76f8\u540c\uff09\uff0c\u82e5\u67d0\u4e00\u5b57\u6bb5\u5728\u6570\u636e\u5e93\u4e2d\u8bbe\u7f6e\u4e86\u4e0d\u80fd\u4e3a\u7a7a\uff0c\u4f46\u5728\u5b9e\u9645\u64cd\u4f5c\u65f6\u5374\u4f20\u5165\u4e86null\u503c\uff0c\u5219\u5c31\u4f1a\u629b\u51fa\u6b64\u5f02\u5e38\uff0c\u5bf9\u5176\u8fdb\u884c\u6355\u83b7\uff0c\u5c31\u53ef\u4ee5\u5f97\u5230\u4fe1\u606f\uff0c\u4e0d\u7528\u4e8b\u5148\u8fdb\u884c\u67e5\u8be2\uff0c\u518d\u8fdb\u884cinsert\uff0c\u76f4\u63a5\u6355\u83b7\u6b64\u5f02\u5e38\u5e76\u8fdb\u884c\u5904\u7406\u5373\u53ef\u3002<br \/>\nimport org.springframework.dao.DataIntegrityViolationException;<\/p>\n<p>try {<br \/>\n??????? dao.insertWords(obj);<br \/>\n??? } catch (DataIntegrityViolationException e) {<br \/>\n??? throw new Exception(&#8220;\u6570\u636e\u5b8c\u6574\u6027\u51b2\u7a81\uff0c\u8bf7\u67e5\u770b\u8868\u7ed3\u6784\u662f\u5426\u5b58\u5728\u95ee\u9898\uff01&#8221;);<br \/>\n??? }<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Spring\u63d0\u4f9b\u4e86\u4e00\u4e2a \u6570\u636e\u5b8c\u6574\u6027\u5f02\u5e38\uff0c\u5f53\u8fdb\u884cinsert\u64cd\u4f5c\u65f6\uff0c\u82e5\u6570\u636e\u5e93\u4e2d\u5df2\u5b58\u5728\u6b64\u8bb0\u5f55\uff08\u4e3b\u952e\u76f8\u540c\uff09\uff0c\u82e5\u67d0\u4e00\u5b57 [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29],"tags":[],"class_list":["post-1011","post","type-post","status-publish","format-standard","hentry","category-spring"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts\/1011","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/comments?post=1011"}],"version-history":[{"count":0,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts\/1011\/revisions"}],"wp:attachment":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/media?parent=1011"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/categories?post=1011"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/tags?post=1011"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}