{"id":24232,"date":"2021-11-28T16:36:11","date_gmt":"2021-11-28T08:36:11","guid":{"rendered":"https:\/\/aqzt.com\/24232.html"},"modified":"2021-11-28T16:36:11","modified_gmt":"2021-11-28T08:36:11","slug":"%e9%ab%98%e5%b9%b6%e5%8f%91-%e6%95%b0%e6%8d%ae%e5%ba%93%e8%87%aa%e5%a2%9e%e4%b8%bb%e9%94%ae-%e8%a7%a3%e5%86%b3","status":"publish","type":"post","link":"https:\/\/aqzt.com\/24232.html","title":{"rendered":"\u9ad8\u5e76\u53d1 \u6570\u636e\u5e93\u81ea\u589e\u4e3b\u952e \u89e3\u51b3"},"content":{"rendered":"<p>\u5728\u4e00\u822c\u60c5\u51b5\u4e0b\uff0c\u5728\u65b0\u589e\u9886\u57df\u5bf9\u8c61\u540e\uff0c\u90fd\u9700\u8981\u83b7\u53d6\u5bf9\u5e94\u7684\u4e3b\u952e\u503c\u3002\u4f7f\u7528\u5e94\u7528\u5c42\u6765\u7ef4\u62a4\u4e3b\u952e\uff0c\u5728\u4e00\u5b9a\u7a0b\u5ea6\u4e0a\u6709\u5229\u4e8e\u7a0b\u5e8f\u6027\u80fd\u7684\u4f18\u5316\u548c\u5e94\u7528\u79fb\u690d\u6027\u7684\u63d0\u9ad8\u3002\u5728\u91c7\u7528\u6570\u636e\u5e93\u81ea\u589e\u4e3b\u952e\u7684\u65b9\u6848\u91cc\uff0c\u5982\u679cJDBC\u9a71\u52a8\u4e0d\u80fd\u7ed1\u5b9a\u65b0\u589e\u8bb0\u5f55\u5bf9\u5e94\u7684\u4e3b\u952e\uff0c\u5c31\u9700\u8981\u624b\u5de5\u6267\u884c\u67e5\u8be2\u8bed\u53e5\u4ee5\u83b7\u53d6\u5bf9\u5e94\u7684\u4e3b\u952e\u503c\uff0c\u5bf9\u4e8e\u9ad8\u5e76\u53d1\u7684\u7cfb\u7edf\uff0c\u8fd9\u5f88\u5bb9\u6613\u8fd4\u56de\u9519\u8bef\u7684\u4e3b\u952e\u3002\u901a\u8fc7\u5e26\u7f13\u5b58\u7684DataFieldMaxValueIncrementer\uff0c\u53ef\u4ee5\u4e00\u6b21\u83b7\u53d6\u6279\u91cf\u7684\u4e3b\u952e\u503c\uff0c\u4f9b\u591a\u6b21\u63d2\u5165\u9886\u57df\u5bf9\u8c61\u65f6\u4f7f\u7528\uff0c\u5b83\u7684\u6267\u884c\u6027\u80fd\u662f\u5f88\u9ad8\u7684\u3002<br \/>\n<strong>\u4f7f\u7528\u6570\u636e\u5e93\u7684\u81ea\u589e\u4e3b\u952e<\/strong><br \/>\n<!-- -->\u6211\u4eec\u7ecf\u5e38\u4f7f\u7528\u6570\u636e\u7684\u81ea\u589e\u5b57\u6bb5\u4f5c\u4e3a\u8868\u4e3b\u952e\uff0c\u4e5f\u5373\u4e3b\u952e\u503c\u4e0d\u5728\u5e94\u7528\u5c42\u4ea7\u751f\uff0c\u800c\u662f\u5728\u65b0\u589e\u8bb0\u5f55\u65f6\uff0c\u7531\u6570\u636e\u5e93\u4ea7\u751f\u3002\u8fd9\u6837\uff0c\u5e94\u7528\u5c42\u5728\u4fdd\u5b58\u5bf9\u8c61\u524d\u5e76\u4e0d\u77e5\u9053\u5bf9\u8c61\u4e3b\u952e\u503c\uff0c\u800c\u5fc5\u987b\u5728\u4fdd\u5b58\u6570\u636e\u540e\u624d\u80fd\u4ece\u6570\u636e\u5e93\u4e2d\u8fd4\u56de\u4e3b\u952e\u503c\u3002\u5728\u5f88\u591a\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u9700\u8981\u83b7\u53d6\u65b0\u5bf9\u8c61\u6301\u4e45\u5316\u540e\u7684\u4e3b\u952e\u503c\u3002\u5728Hibernate\u7b49ORM\u6846\u67b6\uff0c\u65b0\u5bf9\u8c61\u6301\u4e45\u5316\u540e\uff0cHibernate\u4f1a\u81ea\u52a8\u5c06\u4e3b\u952e\u503c\u7ed1\u5b9a\u5230\u5bf9\u8c61\u4e0a\uff0c\u7ed9\u7a0b\u5e8f\u7684\u5f00\u53d1\u5e26\u6765\u4e86\u5f88\u591a\u65b9\u4fbf\u3002<br \/>\n<!-- -->\u5728JDBC 3.0\u89c4\u8303\u4e2d\uff0c\u5f53\u65b0\u589e\u8bb0\u5f55\u65f6\uff0c\u5141\u8bb8\u5c06\u6570\u636e\u5e93\u81ea\u52a8\u4ea7\u751f\u7684\u4e3b\u952e\u503c\u7ed1\u5b9a\u5230Statement\u6216PreparedStatement\u4e2d\u3002\u4f7f\u7528Statement\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u6cd5\u7ed1\u5b9a\u4e3b\u952e\u503c\uff1a<br \/>\n<!-- -->int executeUpdate(String sql,int autoGeneratedKeys)<br \/>\n<!-- -->\u4e5f\u53ef\u4ee5\u901a\u8fc7Connection\u521b\u5efa\u7ed1\u5b9a\u81ea\u589e\u503c\u7684PreparedStatement\uff1a<br \/>\n<!-- -->PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)<br \/>\n<!-- -->\u5f53autoGeneratedKeys\u53c2\u6570\u8bbe\u7f6e\u4e3aStatement.RETURN_GENERATED_KEYS\u503c\u65f6\u5373\u53ef\u7ed1\u5b9a\u6570\u636e\u5e93\u4ea7\u751f\u7684\u4e3b\u952e\u503c\uff0c\u8bbe\u7f6e\u4e3aStatement.NO_GENERATED_KEYS\u65f6\uff0c\u4e0d\u7ed1\u5b9a\u4e3b\u952e\u503c\u3002\u4e0b\u9762\u7684\u4ee3\u7801\u6f14\u793a\u4e86Statement\u7ed1\u5b9a\u5e76\u83b7\u53d6\u6570\u636e\u5e93\u4ea7\u751f\u7684\u4e3b\u952e\u503c\u7684\u8fc7\u7a0b\uff1a<\/p>\n<\/p>\n<pre>\n\n<div class=\"codecolorer-container text solarized-dark language-bash\" style=\"overflow:auto;white-space:nowrap;width:800px;height:300px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/>8<br \/>9<br \/>10<br \/>11<br \/>12<br \/>13<br \/>14<br \/>15<br \/>16<br \/>17<br \/>18<br \/>19<br \/>20<br \/>21<br \/>22<br \/>23<br \/>24<br \/>25<br \/>26<br \/>27<br \/>28<br \/>29<br \/>30<br \/>31<br \/>32<br \/>33<br \/>34<br \/>35<br \/>36<br \/>37<br \/>38<br \/>39<br \/>40<br \/>41<br \/>42<br \/>43<br \/>44<br \/>45<br \/>46<br \/><\/div><\/td><td><div class=\"text codecolorer\">1<br \/>\n2 &nbsp;<br \/>\n3 &nbsp;<br \/>\n4<br \/>\n5<br \/>\n6 &nbsp; <br \/>\n7 &nbsp; <br \/>\n8 &nbsp; <br \/>\n9 &nbsp; Statement stmt <br \/>\n10 &nbsp; <br \/>\n11 &nbsp; =<br \/>\n12 &nbsp; <br \/>\n13 &nbsp; &nbsp;conn.createStatement(); String sql <br \/>\n14 &nbsp; <br \/>\n15 &nbsp; =<br \/>\n16 &nbsp; <br \/>\n17 &nbsp; &nbsp;<br \/>\n18 &nbsp; <br \/>\n19 &nbsp; &amp;quot;<br \/>\n20 &nbsp; <br \/>\n21 &nbsp; INSERT INTO t_topic(topic_title,user_id) VALUES(\u2018\u6d4b\u8bd5\u4e3b\u9898\u2019,\u2019123\u2019) <br \/>\n22 &nbsp; <br \/>\n23 &nbsp; &amp;quot;<br \/>\n24 &nbsp; <br \/>\n25 &nbsp; ; stmt.executeUpdate(sql,Statement.RETURN_GENERATED_KEYS); \u2460\u6307\u5b9a\u7ed1\u5b9a\u8868\u81ea\u589e\u4e3b\u952e\u503c ResultSet rs <br \/>\n26 &nbsp; <br \/>\n27 &nbsp; =<br \/>\n28 &nbsp; <br \/>\n29 &nbsp; &nbsp;stmt.getGeneratedKeys(); <br \/>\n30 &nbsp; <br \/>\n31 &nbsp; if<br \/>\n32 &nbsp; <br \/>\n33 &nbsp; &nbsp;( rs.next() ) { <br \/>\n34 &nbsp; <br \/>\n35 &nbsp; int<br \/>\n36 &nbsp; <br \/>\n37 &nbsp; &nbsp;key <br \/>\n38 &nbsp; <br \/>\n39 &nbsp; =<br \/>\n40 &nbsp; <br \/>\n41 &nbsp; &nbsp;rs.getInt();\u2461\u83b7\u53d6\u5bf9\u5e94\u7684\u8868\u81ea\u589e\u4e3b\u952e\u503c } <br \/>\n42 &nbsp;<br \/>\n43 &nbsp;<br \/>\n44<br \/>\n45<br \/>\n46<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n\n<\/pre>\n<p>Spring\u5229\u7528\u8fd9\u4e00\u6280\u672f\uff0c\u63d0\u4f9b\u4e86\u4e00\u4e2a\u53ef\u4ee5\u8fd4\u56de\u65b0\u589e\u8bb0\u5f55\u5bf9\u5e94\u4e3b\u952e\u503c\u7684\u65b9\u6cd5\uff1a<br \/>\n<!-- -->int update(PreparedStatementCreator psc, KeyHolder generatedKeyHolder)<br \/>\n<!-- -->org.springframework.jdbc.support.KeyHolder\u662f\u4e00\u4e2a\u56de\u8c03\u63a5\u53e3\uff0cSpring\u4f7f\u7528\u5b83\u4fdd\u5b58\u65b0\u589e\u8bb0\u5f55\u5bf9\u5e94\u7684\u4e3b\u952e\uff0c\u8be5\u63a5\u53e3\u7684\u63a5\u53e3\u65b9\u6cd5\u63cf\u8ff0\u5982\u4e0b\uff1a<br \/>\n<!-- -->\uf06c Number getKey() throws InvalidDataAccessApiUsageException<br \/>\n<!-- -->\u5f53\u4ec5\u63d2\u5165\u4e00\u884c\u6570\u636e\uff0c\u4e3b\u952e\u4e0d\u662f\u590d\u5408\u952e\u4e14\u662f\u6570\u5b57\u7c7b\u578b\u65f6\uff0c\u901a\u8fc7\u8be5\u65b9\u6cd5\u53ef\u4ee5\u76f4\u63a5\u8fd4\u56de\u65b0\u7684\u4e3b\u952e\u503c\u3002\u5982\u679c\u662f\u590d\u5408\u4e3b\u952e\uff0c\u6216\u8005\u6709\u591a\u4e2a\u4e3b\u952e\u8fd4\u56de\u65f6\uff0c\u8be5\u65b9\u6cd5\u629b\u51faInvalidDataAccessApiUsageException\u3002\u8be5\u65b9\u6cd5\u662f\u6700\u5e38\u7528\u7684\u65b9\u6cd5\uff0c\u56e0\u4e3a\u4e00\u822c\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u4e00\u6b21\u4ec5\u63d2\u5165\u4e00\u6761\u6570\u636e\u5e76\u4e14\u4e3b\u952e\u5b57\u6bb5\u7c7b\u578b\u4e3a\u6570\u5b57\u7c7b\u578b\uff1b<br \/>\n<!-- -->\uf06c Map getKeys() throws InvalidDataAccessApiUsageException<br \/>\n<!-- -->\u5982\u679c\u662f\u590d\u5408\u4e3b\u952e\uff0c\u5219\u5217\u540d\u548c\u5217\u503c\u6784\u6210Map\u4e2d\u7684\u4e00\u4e2aEntry\u3002\u5982\u679c\u8fd4\u56de\u7684\u662f\u591a\u4e2a\u4e3b\u952e\uff0c\u5219\u8be5\u65b9\u6cd5\u629b\u51faInvalidDataAccessApiUsageException\u5f02\u5e38\uff1b<br \/>\n<!-- -->\uf06c List getKeyList()\uff1a<br \/>\n<!-- -->\u5982\u679c\u8fd4\u56de\u591a\u4e2a\u4e3b\u952e\uff0c\u5373PreparedStatement\u65b0\u589e\u4e86\u591a\u6761\u8bb0\u5f55\uff0c\u5219\u6bcf\u4e00\u4e2a\u4e3b\u952e\u5bf9\u5e94\u4e00\u4e2aMap\uff0c\u591a\u4e2aMap\u6784\u6210\u4e00\u4e2aList\u3002<br \/>\n<!-- -->Spring\u4e3aKeyHolder\u63a5\u53e3\u6307\u4ee3\u4e86\u4e00\u4e2a\u901a\u7528\u7684\u5b9e\u73b0\u7c7bGeneratedKeyHolder\uff0c\u8be5\u7c7b\u8fd4\u56de\u65b0\u589e\u8bb0\u5f55\u65f6\u7684\u81ea\u589e\u957f\u4e3b\u952e\u503c\u3002\u5047\u8bbe\u6211\u4eec\u5e0c\u671b\u5728\u65b0\u589e\u8bba\u575b\u677f\u5757\u5bf9\u8c61\u540e\uff0c\u5e0c\u671b\u5c06\u4e3b\u952e\u503c\u52a0\u8f7d\u5230\u5bf9\u8c61\u4e2d\uff0c\u5219\u53ef\u4ee5\u6309\u4ee5\u4e0b\u4ee3\u7801\u8fdb\u884c\u8c03\u6574\uff1a<\/p>\n<pre>\n\n<div class=\"codecolorer-container text solarized-dark language-bash\" style=\"overflow:auto;white-space:nowrap;width:800px;height:300px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/>8<br \/>9<br \/>10<br \/>11<br \/>12<br \/>13<br \/>14<br \/>15<br \/>16<br \/>17<br \/>18<br \/>19<br \/>20<br \/>21<br \/>22<br \/>23<br \/>24<br \/>25<br \/>26<br \/>27<br \/>28<br \/>29<br \/>30<br \/>31<br \/>32<br \/>33<br \/>34<br \/>35<br \/>36<br \/>37<br \/>38<br \/>39<br \/>40<br \/>41<br \/>42<br \/>43<br \/>44<br \/>45<br \/>46<br \/>47<br \/>48<br \/>49<br \/>50<br \/>51<br \/>52<br \/>53<br \/>54<br \/>55<br \/>56<br \/>57<br \/>58<br \/><\/div><\/td><td><div class=\"text codecolorer\">1<br \/>\n2 &nbsp;<br \/>\n3 &nbsp;<br \/>\n4<br \/>\n5<br \/>\n6 &nbsp; <br \/>\n7 &nbsp; <br \/>\n8 &nbsp; <br \/>\n9 &nbsp; public <br \/>\n10 &nbsp; <br \/>\n11 &nbsp; void<br \/>\n12 &nbsp; <br \/>\n13 &nbsp; &nbsp;addForum(final Forum forum) { final String sql <br \/>\n14 &nbsp; <br \/>\n15 &nbsp; =<br \/>\n16 &nbsp; <br \/>\n17 &nbsp; &nbsp;<br \/>\n18 &nbsp; <br \/>\n19 &nbsp; &amp;quot;<br \/>\n20 &nbsp; <br \/>\n21 &nbsp; INSERT INTO t_forum(forum_name,forum_desc) VALUES(?,?)<br \/>\n22 &nbsp; <br \/>\n23 &nbsp; &amp;quot;<br \/>\n24 &nbsp; <br \/>\n25 &nbsp; ; KeyHolder keyHolder <br \/>\n26 &nbsp; <br \/>\n27 &nbsp; =<br \/>\n28 &nbsp; <br \/>\n29 &nbsp; &nbsp;<br \/>\n30 &nbsp; <br \/>\n31 &nbsp; new<br \/>\n32 &nbsp; <br \/>\n33 &nbsp; &nbsp;GeneratedKeyHolder();\u2460\u521b\u5efa\u4e00\u4e2a\u4e3b\u952e\u6267\u6709\u8005 getJdbcTemplate().update(<br \/>\n34 &nbsp; <br \/>\n35 &nbsp; new<br \/>\n36 &nbsp; <br \/>\n37 &nbsp; &nbsp;PreparedStatementCreator(){ public PreparedStatement createPreparedStatement(Connection conn) throws SQLException { PreparedStatement ps <br \/>\n38 &nbsp; <br \/>\n39 &nbsp; =<br \/>\n40 &nbsp; <br \/>\n41 &nbsp; &nbsp;conn.prepareStatement(sql); ps.setString(<br \/>\n42 &nbsp; <br \/>\n43 &nbsp; 1<br \/>\n44 &nbsp; <br \/>\n45 &nbsp; , forum.getForumName()); ps.setString(<br \/>\n46 &nbsp; <br \/>\n47 &nbsp; 2<br \/>\n48 &nbsp; <br \/>\n49 &nbsp; , forum.getForumDesc()); <br \/>\n50 &nbsp; <br \/>\n51 &nbsp; return<br \/>\n52 &nbsp; <br \/>\n53 &nbsp; &nbsp;ps; } },keyHolder); forum.setForumId(keyHolder.getKey().intValue());\u2461\u4ece\u4e3b\u952e\u6267\u6709\u8005\u4e2d\u83b7\u53d6\u4e3b\u952e } <br \/>\n54 &nbsp;<br \/>\n55 &nbsp;<br \/>\n56<br \/>\n57<br \/>\n58<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n\n<\/pre>\n<p>\u00a0\u00a0\u00a0\u00a0 \u8fd9\u6837\uff0c\u5728\u8c03\u7528addForum(final Forum forum)\u65b0\u589eforum\u9886\u57df\u5bf9\u8c61\u540e\uff0cforum\u5c06\u62e5\u6709\u5bf9\u5e94\u7684\u4e3b\u952e\u503c\uff0c\u65b9\u4fbf\u540e\u7ee7\u7684\u4f7f\u7528\u3002<br \/>\n<!-- -->\u5728JDBC 3.0\u4e4b\u524d\u7684\u7248\u672c\u4e2d\uff0cPreparedStatement\u4e0d\u80fd\u7ed1\u5b9a\u4e3b\u952e\uff0c\u5982\u679c\u91c7\u7528\u8868\u81ea\u589e\u952e\uff08\u5982MySql\u7684auto increment\u6216SqlServer\u7684identity\uff09\u5c06\u7ed9\u83b7\u53d6\u6b63\u786e\u7684\u4e3b\u952e\u503c\u5e26\u6765\u6311\u6218\u2014\u2014\u56e0\u4e3a\u4f60\u5fc5\u987b\u5728\u63d2\u5165\u6570\u636e\u540e\uff0c\u9a6c\u4e0a\u6267\u884c\u53e6\u4e00\u6761\u83b7\u53d6\u65b0\u589e\u4e3b\u952e\u7684\u67e5\u8be2\u8bed\u53e5\u3002\u8868 1\u7ed9\u51fa\u4e86\u4e0d\u540c\u6570\u636e\u5e93\u83b7\u53d6\u6700\u65b0\u81ea\u589e\u4e3b\u952e\u503c\u7684\u67e5\u8be2\u8bed\u53e5\uff1a<br \/>\n<!-- -->\u8868 1 \u4e0d\u540c\u6570\u636e\u5e93\u83b7\u53d6\u65b0\u589e\u52a0\u7684\u4e3b\u952e\u503c\u00a0<\/p>\n<table>\n<thead>\n<tr>\n<th><\/th>\n<th><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u6570\u636e\u5e93<\/td>\n<td>\u83b7\u53d6\u65b0\u589e\u4e3b\u952e\u7684\u67e5\u8be2\u8bed\u53e5<\/td>\n<\/tr>\n<tr>\n<td>DB2<\/td>\n<td>IDENTITY_VAL_LOCAL()<\/td>\n<\/tr>\n<tr>\n<td>Informix<\/td>\n<td>SELECT dbinfo(&#x27;sqlca.sqlerrd1&#x27;) FROM <!-- -->&lt;TABLE&gt;<\/td>\n<\/tr>\n<tr>\n<td>Sybase<\/td>\n<td>SELECT @@IDENTITY<\/td>\n<\/tr>\n<tr>\n<td>SqlServer<\/td>\n<td>SELECT SCOPE_IDENTITY()\u6216SELECT @@IDENTITY<\/td>\n<\/tr>\n<tr>\n<td>MySql<\/td>\n<td>SELECT LAST_INSERT_ID()<\/td>\n<\/tr>\n<tr>\n<td>HsqlDB<\/td>\n<td>CALL IDENTITY()<\/td>\n<\/tr>\n<tr>\n<td>Cloudscape<\/td>\n<td>IDENTITY_VAL_LOCAL()<\/td>\n<\/tr>\n<tr>\n<td>Derby<\/td>\n<td>IDENTITY_VAL_LOCAL()<\/td>\n<\/tr>\n<tr>\n<td>PostgreSQL<\/td>\n<td>SELECT nextval(&#x27;<!-- -->&lt;TABLE&gt;<!-- -->_SEQ&#x27;)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><div class=\"codecolorer-container text solarized-dark language-bash\" style=\"overflow:auto;white-space:nowrap;width:800px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/><\/div><\/td><td><div class=\"text codecolorer\">1<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n<\/p>\n<p>\u00a0\u00a0\u00a0<br \/>\n<!-- -->\u5982\u679c\u6570\u636e\u5e93\u7684\u5e76\u53d1\u7387\u5f88\u9ad8\uff0c\u6bd4\u5982\u5728\u63d2\u5165\u8bb0\u5f55\u540e\u6267\u884c\u67e5\u8be2\u4e3b\u952e\u4e4b\u524d\uff0c\u6570\u636e\u5e93\u53c8\u6267\u884c\u4e86\u82e5\u5e72\u6761\u63d2\u5165\u8bb0\u5f55\u7684SQL\u8bed\u53e5\uff0c\u8fd9\u65f6\uff0c\u901a\u8fc7\u8868 1 \u8fd4\u56de\u7684\u4e3b\u952e\u503c\u5c31\u662f\u6700\u540e\u4e00\u6761\u63d2\u5165\u8bed\u53e5\u7684\u4e3b\u952e\u503c\uff0c\u800c\u975e\u6211\u4eec\u5e0c\u671b\u7684\u4e3b\u952e\u503c\u4e86\u3002\u6240\u4ee5\u4f7f\u7528\u67e5\u8be2\u8bed\u53e5\u83b7\u53d6\u8868\u81ea\u589e\u952e\u503c\u662f\u4e0d\u5b89\u5168\u7684\uff0c\u8fd9\u4e5f\u662f\u4e3a\u4ec0\u4e48\u6709\u4e9b\u6570\u636e\u5e93\uff08\u5982Oracle\u3001Firebird\uff09\u6545\u610f\u4e0d\u63d0\u4f9b\u81ea\u589e\u952e\uff0c\u800c\u53ea\u63d0\u4f9b\u5e8f\u5217\u7684\u539f\u56e0\uff0c\u5e8f\u5217\u5f3a\u5236\u8981\u6c42\u4f60\u5728\u65b0\u589e\u8bb0\u5f55\u524d\uff0c\u5148\u83b7\u53d6\u4e3b\u952e\u503c\u3002Oracle\u901a\u8fc7SELECT &lt;SEQUENCE_NAME&gt;.nextval FROM DUAL\u83b7\u53d6\u5e8f\u5217\u7684\u4e0b\u4e00\u4e2a\u503c\uff0c\u800cFireBird\u901a\u8fc7SELECT GEN_ID(&lt;SEQUENCE_NAME&gt; 1) FROM RDB$DATABASE\u83b7\u53d6\u5e8f\u5217\u7684\u4e0b\u4e00\u4e2a\u503c\u3002\u572810.4.1\u5c0f\u8282\u4e2d\uff0c\u6211\u4eec\u8fd8\u5c06\u8bb2\u89e3\u5e94\u7528\u5c42\u81ea\u589e\u952e\u7684\u76f8\u5173\u77e5\u8bc6\u3002<\/p>\n<p>\u5e94\u7528\u5c42\u4ea7\u751f\u4e3b\u952e<br \/>\n<!-- -->Spring JDBC\u63d0\u4f9b\u4e86\u81ea\u589e\u952e\u4ee5\u53ca\u884c\u96c6\u7684\u652f\u6301\uff0c\u81ea\u589e\u952e\u5bf9\u8c61\u8ba9\u6211\u4eec\u53ef\u4ee5\u4e0d\u4f9d\u8d56\u6570\u636e\u5e93\u7684\u81ea\u589e\u952e\uff0c\u5728\u5e94\u7528\u5c42\u4e3a\u65b0\u8bb0\u5f55\u63d0\u4f9b\u4e3b\u952e\u503c\u3002\u5728JDK 1.4\u4e2d\u5f15\u5165\u4e86RowSet\uff0c\u5b83\u5141\u8bb8\u5728\u8fde\u63a5\u65ad\u5f00\u7684\u60c5\u51b5\u4e0b\u64cd\u4f5c\u6570\u636e\uff0c\u5728\u8fd9\u8282\u91cc\uff0c\u6211\u4eec\u5c06\u4ecb\u7ecd\u5982\u4f55\u5728Spring JDBC\u4e2d\u4f7f\u7528RowSet\u3002<br \/>\n<!-- -->\u81ea\u589e\u952e\u7684\u4f7f\u7528<br \/>\n<!-- -->\u4e00\u822c\u6570\u636e\u5e93\u90fd\u63d0\u4f9b\u4e86\u81ea\u589e\u952e\u7684\u529f\u80fd\uff0c\u5982MySql\u7684auto_increment\u3001SqlServerr\u7684identity\u5b57\u6bb5\u7b49\u3002Spring\u5141\u8bb8\u4f60\u5728\u5e94\u7528\u5c42\u4ea7\u751f\u4e3b\u952e\u503c\uff0c\u4e3a\u6b64\u5b9a\u4e49\u4e86org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer\u63a5\u53e3\uff0c\u63d0\u4f9b\u4e24\u79cd\u4ea7\u751f\u4e3b\u952e\u7684\u65b9\u6848\uff1a\u7b2c\u4e00\uff0c\u901a\u8fc7\u5e8f\u5217\u4ea7\u751f\u4e3b\u952e\uff1b\u7b2c\u4e8c\uff0c\u901a\u8fc7\u8868\u4ea7\u751f\u4e3b\u952e\u3002\u6839\u636e\u4e3b\u952e\u4ea7\u751f\u65b9\u5f0f\u548c\u6570\u636e\u5e93\u7684\u4e0d\u540c\uff0cSpring\u63d0\u4f9b\u4e86\u82e5\u5e72\u5b9e\u73b0\u7c7b\uff0c\u5982\u56fe 1\u6240\u793a\uff1a\u00a0<br \/>\n<!-- -->\u56fe 1 DateFieldValueIncrementer\u7ee7\u627f\u7c7b\u56fe<br \/>\n<!-- -->\u6839\u636e\u4e0d\u540c\u7684\u4e3b\u952e\u4ea7\u751f\u65b9\u5f0f\uff0c\u53ef\u80fd\u9700\u8981\u914d\u7f6e\u8868\u540d\u3001\u4e3b\u952e\u5b57\u6bb5\u540d\u6216\u5e8f\u5217\u540d\u7b49\u4fe1\u606f\u3002\u4e0b\u9762\uff0c\u6211\u4eec\u4ee5Oracle\u548cMySql\u4e3a\u4f8b\u5206\u522b\u8bb2\u89e3\u4f7f\u7528\u5e8f\u5217\u53ca\u8868\u5b57\u6bb5\u4ea7\u751f\u4e3b\u952e\u503c\u7684\u65b9\u5f0f\u3002<br \/>\n<!-- -->DataFieldMaxValueIncrementer\u63a5\u53e3\u5b9a\u4e49\u4e863\u4e2a\u83b7\u53d6\u4e0b\u4e00\u4e2a\u4e3b\u952e\u503c\u7684\u65b9\u6cd5\uff1a<br \/>\n<!-- -->\uf06c int nextIntValue()\uff1a\u83b7\u53d6\u4e0b\u4e00\u4e2a\u4e3b\u952e\u503c\uff0c\u4e3b\u952e\u6570\u636e\u7c7b\u578b\u4e3aint\uff1b<br \/>\n<!-- -->\uf06c long nextLongValue()\uff1a\u83b7\u53d6\u4e0b\u4e00\u4e2a\u4e3b\u952e\u503c\uff0c\u4e3b\u952e\u6570\u636e\u7c7b\u578b\u4e3along\uff1b<br \/>\n<!-- -->\uf06c String nextStringValue()\uff1a\u83b7\u53d6\u4e0b\u4e00\u4e2a\u4e3b\u952e\u503c\uff0c\u4e3b\u952e\u6570\u636e\u7c7b\u578b\u4e3aString\uff1b<br \/>\n<!-- -->\u5728\u5176\u62bd\u8c61\u5b9e\u73b0\u7c7bAbstractDataFieldMaxValueIncrementer\u4e2d\uff0c\u63d0\u4f9b\u4e86\u51e0\u4e2a\u91cd\u8981\u7684\u5c5e\u6027\uff0c\u5176\u4e2dincrementerName\u5b9a\u4e49\u5e8f\u5217\u6216\u4e3b\u952e\u8868\u7684\u540d\u79f0\uff1b\u5982\u679c\u8fd4\u56de\u7684\u4e3b\u952e\u662fString\u7c7b\u578b\uff0c\u5219paddingLength\u5c5e\u6027\u53ef\u80fd\u4f1a\u6d3e\u4e0a\u7528\u573a\uff0c\u5b83\u5141\u8bb8\u4f60\u6307\u5b9a\u8fd4\u56de\u4e3b\u952e\u7684\u957f\u5ea6\uff0c\u4e0d\u8db3\u7684\u90e8\u5206\u524d\u9762\u88650\u3002<br \/>\n<!-- -->HsqlMaxValueIncrementer\u548cMySQLMaxValueIncrementer\u4e24\u4e2a\u4e3b\u952e\u503c\u4ea7\u751f\u5668\u57fa\u4e8e\u8868\u8fdb\u884c\u5de5\u4f5c\u3002\u901a\u8fc7columnName\u5c5e\u6027\u5b9a\u4e49\u4e3b\u952e\u5217\u7684\u540d\u5b57\uff0c\u901a\u8fc7cacheSize\u5c5e\u6027\u5b9a\u4e49\u7f13\u5b58\u7684\u4e3b\u952e\u4e2a\u6570\uff0c\u5f53\u5185\u5b58\u4e2d\u7684\u4e3b\u952e\u503c\u7528\u5b8c\u540e\uff0c\u4ea7\u751f\u5668\u5c06\u4e00\u6b21\u6027\u83b7\u53d6cacheSize\u4e2a\u4e3b\u952e\uff0c\u8fd9\u6837\u53ef\u4ee5\u51cf\u5c11\u6570\u636e\u8bbf\u95ee\u7684\u6b21\u6570\uff0c\u63d0\u9ad8\u5e94\u7528\u7684\u6027\u80fd\u3002<br \/>\n<!-- -->\u6211\u4eec\u901a\u8fc7DateFieldValueIncrementer\u4ece\u6570\u636e\u5e93\u4e2d\u83b7\u53d6\u4e3b\u952e\u503c\u6765\u5f25\u8865\u8fd9\u4e2a\u7f3a\u9677\u3002\u9996\u5148\uff0c\u8c03\u6574PostJdbcDao\u7684\u4ee3\u7801\uff0c\u6dfb\u52a0DateFieldValueIncrementer\u5c5e\u6027\uff0c\u5e76\u901a\u8fc7\u5b83\u4ece\u5e8f\u5217\u4e2d\u5f97\u5230\u4e0b\u4e00\u4e2a\u4e3b\u952e\u503c\uff1a<br \/>\n<!-- -->\u4ee3\u7801\u6e05\u5355 13 \u4f7f\u7528DateFieldValueIncrementer\u4ea7\u751f\u4e3b\u952e<\/p>\n<pre>\n\n<div class=\"codecolorer-container text solarized-dark language-bash\" style=\"overflow:auto;white-space:nowrap;width:800px;height:300px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/>8<br \/>9<br \/>10<br \/>11<br \/>12<br \/>13<br \/>14<br \/>15<br \/>16<br \/>17<br \/>18<br \/>19<br \/>20<br \/>21<br \/>22<br \/>23<br \/>24<br \/>25<br \/>26<br \/>27<br \/>28<br \/>29<br \/>30<br \/>31<br \/>32<br \/>33<br \/>34<br \/>35<br \/>36<br \/>37<br \/>38<br \/>39<br \/>40<br \/>41<br \/>42<br \/><\/div><\/td><td><div class=\"text codecolorer\">1<br \/>\n2 &nbsp; <br \/>\n3 &nbsp; <br \/>\n4<br \/>\n5<br \/>\n6 &nbsp; &nbsp;<br \/>\n7 &nbsp; &nbsp;<br \/>\n8 &nbsp; &nbsp;<br \/>\n9 &nbsp; &nbsp;public class PostJdbcDao extends JdbcDaoSupport implements PostDao { private DataFieldMaxValueIncrementer incre; \u2460\u4e3b\u952e\u503c\u4ea7\u751f\u5668 public <br \/>\n10 &nbsp; &nbsp;<br \/>\n11 &nbsp; &nbsp;void<br \/>\n12 &nbsp; &nbsp;<br \/>\n13 &nbsp; &nbsp; addPost(final Post post) { \u2026 getJdbcTemplate().execute( sql,<br \/>\n14 &nbsp; &nbsp;<br \/>\n15 &nbsp; &nbsp;new<br \/>\n16 &nbsp; &nbsp;<br \/>\n17 &nbsp; &nbsp; AbstractLobCreatingPreparedStatementCallback( <br \/>\n18 &nbsp; &nbsp;<br \/>\n19 &nbsp; &nbsp;this<br \/>\n20 &nbsp; &nbsp;<br \/>\n21 &nbsp; &nbsp;.lobHandler) { protected <br \/>\n22 &nbsp; &nbsp;<br \/>\n23 &nbsp; &nbsp;void<br \/>\n24 &nbsp; &nbsp;<br \/>\n25 &nbsp; &nbsp; setValues(PreparedStatement ps, LobCreator lobCreator) throws SQLException { ps.setInt(<br \/>\n26 &nbsp; &nbsp;<br \/>\n27 &nbsp; &nbsp;1<br \/>\n28 &nbsp; &nbsp;<br \/>\n29 &nbsp; &nbsp;, incre.nextIntValue());\u2461\u83b7\u53d6\u4e0b\u4e00\u4e2a\u4e3b\u952e\u503c \u2026 } }); } \u2026<br \/>\n30 &nbsp; &nbsp;<br \/>\n31 &nbsp; &nbsp;\/\/<br \/>\n32 &nbsp; &nbsp;<br \/>\n33 &nbsp; &nbsp;\u7701\u7565get\/setter\u65b9\u6cd5 <br \/>\n34 &nbsp; &nbsp;<br \/>\n35 &nbsp; &nbsp; <br \/>\n36 &nbsp; &nbsp;<br \/>\n37 &nbsp; &nbsp;} <br \/>\n38 &nbsp; <br \/>\n39 &nbsp; <br \/>\n40<br \/>\n41<br \/>\n42<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n\n<\/pre>\n<p>\u5728\u2461\u5904\uff0c\u6211\u4eec\u901a\u8fc7incre.nextIntValue()\u83b7\u53d6\u4e0b\u4e00\u4e2a\u4e3b\u952e\u503c\u3002<\/p>\n<p><strong>\u4ee5\u5e8f\u5217\u65b9\u5f0f\u4ea7\u751f\u4e3b\u952e\u503c<\/strong><br \/>\n<!-- -->\u5728Oracle\u6570\u636e\u5e93\u4e2d\u521b\u5efa\u4e00\u4e2aseq_post_id\u5e8f\u5217\uff0c\u4f7f\u7528\u8fd9\u4e2a\u5e8f\u5217\u4e3at_post\u63d0\u4f9b\u4e3b\u952e\u503c\uff0c\u4ee5\u4e0b\u662f\u521b\u5efaseq_post_id\u7684\u811a\u672c\uff1a\u00a0<\/p>\n<pre>\n\n<div class=\"codecolorer-container text solarized-dark language-bash\" style=\"overflow:auto;white-space:nowrap;width:800px;height:300px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/>8<br \/>9<br \/>10<br \/>11<br \/>12<br \/>13<br \/>14<br \/>15<br \/>16<br \/>17<br \/>18<br \/>19<br \/>20<br \/>21<br \/>22<br \/>23<br \/>24<br \/>25<br \/>26<br \/>27<br \/>28<br \/>29<br \/>30<br \/><\/div><\/td><td><div class=\"text codecolorer\">1<br \/>\n2 &nbsp; <br \/>\n3 &nbsp; <br \/>\n4<br \/>\n5<br \/>\n6 &nbsp; &nbsp;<br \/>\n7 &nbsp; &nbsp;create<br \/>\n8 &nbsp; &nbsp;<br \/>\n9 &nbsp; &nbsp; sequence seq_post_id increment <br \/>\n10 &nbsp; &nbsp;<br \/>\n11 &nbsp; &nbsp;by<br \/>\n12 &nbsp; &nbsp;<br \/>\n13 &nbsp; &nbsp; <br \/>\n14 &nbsp; &nbsp;<br \/>\n15 &nbsp; &nbsp;1<br \/>\n16 &nbsp; &nbsp;<br \/>\n17 &nbsp; &nbsp; start <br \/>\n18 &nbsp; &nbsp;<br \/>\n19 &nbsp; &nbsp;with<br \/>\n20 &nbsp; &nbsp;<br \/>\n21 &nbsp; &nbsp; <br \/>\n22 &nbsp; &nbsp;<br \/>\n23 &nbsp; &nbsp;1<br \/>\n24 &nbsp; &nbsp;<br \/>\n25 &nbsp; &nbsp;; <br \/>\n26 &nbsp; <br \/>\n27 &nbsp; <br \/>\n28<br \/>\n29<br \/>\n30<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n\n<\/pre>\n<p>\u00a0\u00a0 \u63a5\u7740\uff0c\u8c03\u6574Spring\u7684\u914d\u7f6e\uff0c\u4f7f\u7528OracleSequenceMaxValueIncrementer\u4f5c\u4e3a\u4e3b\u952e\u4ea7\u751f\u5668\uff1a<\/p>\n<pre>\n\n<div class=\"codecolorer-container text solarized-dark language-bash\" style=\"overflow:auto;white-space:nowrap;width:800px;height:300px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/>8<br \/>9<br \/>10<br \/>11<br \/>12<br \/>13<br \/>14<br \/>15<br \/>16<br \/>17<br \/>18<br \/>19<br \/>20<br \/>21<br \/>22<br \/>23<br \/>24<br \/>25<br \/>26<br \/>27<br \/>28<br \/>29<br \/>30<br \/>31<br \/>32<br \/>33<br \/>34<br \/>35<br \/>36<br \/>37<br \/>38<br \/>39<br \/>40<br \/>41<br \/>42<br \/>43<br \/>44<br \/>45<br \/>46<br \/>47<br \/>48<br \/>49<br \/>50<br \/>51<br \/>52<br \/>53<br \/>54<br \/>55<br \/>56<br \/>57<br \/>58<br \/>59<br \/>60<br \/>61<br \/>62<br \/>63<br \/>64<br \/>65<br \/>66<br \/>67<br \/>68<br \/>69<br \/>70<br \/>71<br \/>72<br \/>73<br \/>74<br \/>75<br \/>76<br \/>77<br \/>78<br \/>79<br \/>80<br \/>81<br \/>82<br \/>83<br \/>84<br \/>85<br \/>86<br \/>87<br \/>88<br \/>89<br \/>90<br \/>91<br \/>92<br \/>93<br \/>94<br \/>95<br \/>96<br \/>97<br \/>98<br \/>99<br \/>100<br \/>101<br \/>102<br \/>103<br \/>104<br \/>105<br \/>106<br \/>107<br \/>108<br \/>109<br \/>110<br \/>111<br \/>112<br \/>113<br \/>114<br \/>115<br \/>116<br \/>117<br \/>118<br \/>119<br \/>120<br \/>121<br \/>122<br \/>123<br \/>124<br \/>125<br \/>126<br \/>127<br \/>128<br \/><\/div><\/td><td><div class=\"text codecolorer\">1<br \/>\n2 &nbsp; <br \/>\n3 &nbsp; <br \/>\n4<br \/>\n5<br \/>\n6 &nbsp; &nbsp;<br \/>\n7 &nbsp; &nbsp;<br \/>\n8 &nbsp; &nbsp;<br \/>\n9 &nbsp; &nbsp;&amp;lt;<br \/>\n10 &nbsp; &nbsp;<br \/>\n11 &nbsp; &nbsp;bean <br \/>\n12 &nbsp; &nbsp;<br \/>\n13 &nbsp; &nbsp;id<br \/>\n14 &nbsp; &nbsp;<br \/>\n15 &nbsp; &nbsp;=&amp;quot;incre&amp;quot;<br \/>\n16 &nbsp; &nbsp;<br \/>\n17 &nbsp; &nbsp; class<br \/>\n18 &nbsp; &nbsp;<br \/>\n19 &nbsp; &nbsp;=&amp;quot;org.springframework.jdbc.support.incrementer.OracleSequenceMaxValueIncrementer&amp;quot;<br \/>\n20 &nbsp; &nbsp;<br \/>\n21 &nbsp; &nbsp;&amp;gt;<br \/>\n22 &nbsp; &nbsp;<br \/>\n23 &nbsp; &nbsp; <br \/>\n24 &nbsp; &nbsp;<br \/>\n25 &nbsp; &nbsp;&amp;lt;<br \/>\n26 &nbsp; &nbsp;<br \/>\n27 &nbsp; &nbsp;property <br \/>\n28 &nbsp; &nbsp;<br \/>\n29 &nbsp; &nbsp;name<br \/>\n30 &nbsp; &nbsp;<br \/>\n31 &nbsp; &nbsp;=&amp;quot;incrementerName&amp;quot;<br \/>\n32 &nbsp; &nbsp;<br \/>\n33 &nbsp; &nbsp; value<br \/>\n34 &nbsp; &nbsp;<br \/>\n35 &nbsp; &nbsp;=&amp;quot;seq_post_id&amp;quot;<br \/>\n36 &nbsp; &nbsp;<br \/>\n37 &nbsp; &nbsp;\/&amp;gt;<br \/>\n38 &nbsp; &nbsp;<br \/>\n39 &nbsp; &nbsp; \u2460\u6307\u5b9a\u5e8f\u5217\u540d <br \/>\n40 &nbsp; &nbsp;<br \/>\n41 &nbsp; &nbsp;&amp;lt;<br \/>\n42 &nbsp; &nbsp;<br \/>\n43 &nbsp; &nbsp;property <br \/>\n44 &nbsp; &nbsp;<br \/>\n45 &nbsp; &nbsp;name<br \/>\n46 &nbsp; &nbsp;<br \/>\n47 &nbsp; &nbsp;=&amp;quot;dataSource&amp;quot;<br \/>\n48 &nbsp; &nbsp;<br \/>\n49 &nbsp; &nbsp; ref<br \/>\n50 &nbsp; &nbsp;<br \/>\n51 &nbsp; &nbsp;=&amp;quot;dataSource&amp;quot;<br \/>\n52 &nbsp; &nbsp;<br \/>\n53 &nbsp; &nbsp;\/&amp;gt;<br \/>\n54 &nbsp; &nbsp;<br \/>\n55 &nbsp; &nbsp; \u2461\u8bbe\u7f6e\u6570\u636e\u6e90 <br \/>\n56 &nbsp; &nbsp;<br \/>\n57 &nbsp; &nbsp;&amp;lt;\/<br \/>\n58 &nbsp; &nbsp;<br \/>\n59 &nbsp; &nbsp;bean<br \/>\n60 &nbsp; &nbsp;<br \/>\n61 &nbsp; &nbsp;&amp;gt;<br \/>\n62 &nbsp; &nbsp;<br \/>\n63 &nbsp; &nbsp; <br \/>\n64 &nbsp; &nbsp;<br \/>\n65 &nbsp; &nbsp;&amp;lt;<br \/>\n66 &nbsp; &nbsp;<br \/>\n67 &nbsp; &nbsp;bean <br \/>\n68 &nbsp; &nbsp;<br \/>\n69 &nbsp; &nbsp;id<br \/>\n70 &nbsp; &nbsp;<br \/>\n71 &nbsp; &nbsp;=&amp;quot;postDao&amp;quot;<br \/>\n72 &nbsp; &nbsp;<br \/>\n73 &nbsp; &nbsp; parent<br \/>\n74 &nbsp; &nbsp;<br \/>\n75 &nbsp; &nbsp;=&amp;quot;dao&amp;quot;<br \/>\n76 &nbsp; &nbsp;<br \/>\n77 &nbsp; &nbsp; class<br \/>\n78 &nbsp; &nbsp;<br \/>\n79 &nbsp; &nbsp;=&amp;quot;com.baobaotao.dao.jdbc.PostJdbcDao&amp;quot;<br \/>\n80 &nbsp; &nbsp;<br \/>\n81 &nbsp; &nbsp;&amp;gt;<br \/>\n82 &nbsp; &nbsp;<br \/>\n83 &nbsp; &nbsp; <br \/>\n84 &nbsp; &nbsp;<br \/>\n85 &nbsp; &nbsp;&amp;lt;<br \/>\n86 &nbsp; &nbsp;<br \/>\n87 &nbsp; &nbsp;property <br \/>\n88 &nbsp; &nbsp;<br \/>\n89 &nbsp; &nbsp;name<br \/>\n90 &nbsp; &nbsp;<br \/>\n91 &nbsp; &nbsp;=&amp;quot;lobHandler&amp;quot;<br \/>\n92 &nbsp; &nbsp;<br \/>\n93 &nbsp; &nbsp; ref<br \/>\n94 &nbsp; &nbsp;<br \/>\n95 &nbsp; &nbsp;=&amp;quot;oracleLobHandler&amp;quot;<br \/>\n96 &nbsp; &nbsp;<br \/>\n97 &nbsp; &nbsp;\/&amp;gt;<br \/>\n98 &nbsp; &nbsp;<br \/>\n99 &nbsp; &nbsp; <br \/>\n100 &nbsp; &nbsp;<br \/>\n101 &nbsp; &nbsp;&amp;lt;<br \/>\n102 &nbsp; &nbsp;<br \/>\n103 &nbsp; &nbsp;property <br \/>\n104 &nbsp; &nbsp;<br \/>\n105 &nbsp; &nbsp;name<br \/>\n106 &nbsp; &nbsp;<br \/>\n107 &nbsp; &nbsp;=&amp;quot;incre&amp;quot;<br \/>\n108 &nbsp; &nbsp;<br \/>\n109 &nbsp; &nbsp; ref<br \/>\n110 &nbsp; &nbsp;<br \/>\n111 &nbsp; &nbsp;=&amp;quot;incre&amp;quot;<br \/>\n112 &nbsp; &nbsp;<br \/>\n113 &nbsp; &nbsp;\/&amp;gt;<br \/>\n114 &nbsp; &nbsp;<br \/>\n115 &nbsp; &nbsp; \u2462\u6dfb\u52a0\u4e3b\u952e\u4e3b\u952e\u4ea7\u751f\u5668 <br \/>\n116 &nbsp; &nbsp;<br \/>\n117 &nbsp; &nbsp;&amp;lt;\/<br \/>\n118 &nbsp; &nbsp;<br \/>\n119 &nbsp; &nbsp;bean<br \/>\n120 &nbsp; &nbsp;<br \/>\n121 &nbsp; &nbsp;&amp;gt;<br \/>\n122 &nbsp; &nbsp;<br \/>\n123 &nbsp; &nbsp; <br \/>\n124 &nbsp; <br \/>\n125 &nbsp; <br \/>\n126<br \/>\n127<br \/>\n128<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n\n<\/pre>\n<p>\u00a0 \u4ee5\u8868\u65b9\u5f0f\u4ea7\u751f\u4e3b\u952e\u503c\u00a0<br \/>\n<!-- -->\u5728Mysql\u4e2d\u521b\u5efa\u4e00\u5f20\u7528\u4e8e\u7ef4\u62a4t_post\u4e3b\u952e\u7684t_post_id\u8868\uff0c\u4ee5\u4e0b\u662f\u521b\u5efa\u8be5\u8868\u53ca\u63d2\u5165\u521d\u59cb\u5316\u7684SQL\u811a\u672c\uff1a<\/p>\n<pre>\n\n<div class=\"codecolorer-container text solarized-dark language-bash\" style=\"overflow:auto;white-space:nowrap;width:800px;height:300px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/>8<br \/>9<br \/>10<br \/>11<br \/>12<br \/>13<br \/>14<br \/>15<br \/>16<br \/>17<br \/>18<br \/>19<br \/>20<br \/>21<br \/>22<br \/>23<br \/>24<br \/>25<br \/>26<br \/>27<br \/>28<br \/><\/div><\/td><td><div class=\"text codecolorer\">1<br \/>\n2 &nbsp; <br \/>\n3 &nbsp; <br \/>\n4<br \/>\n5<br \/>\n6 &nbsp; &nbsp;<br \/>\n7 &nbsp; &nbsp;<br \/>\n8 &nbsp; &nbsp;<br \/>\n9 &nbsp; &nbsp;<br \/>\n10 &nbsp; &nbsp;<br \/>\n11 &nbsp; &nbsp;create table t_post_id(sequence_id <br \/>\n12 &nbsp; &nbsp;<br \/>\n13 &nbsp; &nbsp;int<br \/>\n14 &nbsp; &nbsp;<br \/>\n15 &nbsp; &nbsp;) type <br \/>\n16 &nbsp; &nbsp;<br \/>\n17 &nbsp; &nbsp;=<br \/>\n18 &nbsp; &nbsp;<br \/>\n19 &nbsp; &nbsp; MYISAM; insert into t_post_id values(<br \/>\n20 &nbsp; &nbsp;<br \/>\n21 &nbsp; &nbsp;0<br \/>\n22 &nbsp; &nbsp;<br \/>\n23 &nbsp; &nbsp;); <br \/>\n24 &nbsp; <br \/>\n25 &nbsp; <br \/>\n26<br \/>\n27<br \/>\n28<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n\n<\/pre>\n<p>\u00a0\u00a0\u00a0 \u7531\u4e8e\u4e3b\u952e\u7ef4\u62a4\u8868\u7684\u5e76\u53d1\u8bbf\u95ee\u91cf\u5f88\u5927\uff0c\u6240\u4ee5\u6700\u597d\u5c06\u5176\u58f0\u660e\u4e3aMYISAM\u7c7b\u578b\uff0c\u6b64\u5916\u9700\u8981\u4e3a\u8be5\u8868\u63d0\u4f9b\u521d\u59cb\u503c\uff0c\u4ee5\u4fbf\u540e\u7eed\u4e3b\u952e\u503c\u5728\u6b64\u4e4b\u4e0a\u8fdb\u884c\u9012\u589e\u3002<br \/>\n<!-- -->\u8c03\u6574\u4e3aMySql\u6570\u636e\u5e93\u540e\uff0c\u6211\u4eec\u4ec5\u9700\u8981\u5bf9Spring\u914d\u7f6e\u8fdb\u884c\u5c0f\u5c0f\u7684\u8c03\u6574\u5c31\u53ef\u4ee5\u4e86\uff1a<\/p>\n<pre>\n\n<div class=\"codecolorer-container text solarized-dark language-bash\" style=\"overflow:auto;white-space:nowrap;width:800px;height:300px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/>7<br \/>8<br \/>9<br \/>10<br \/>11<br \/>12<br \/>13<br \/>14<br \/>15<br \/>16<br \/>17<br \/>18<br \/>19<br \/>20<br \/>21<br \/>22<br \/>23<br \/>24<br \/>25<br \/>26<br \/>27<br \/>28<br \/>29<br \/>30<br \/>31<br \/>32<br \/>33<br \/>34<br \/>35<br \/>36<br \/>37<br \/>38<br \/>39<br \/>40<br \/>41<br \/>42<br \/>43<br \/>44<br \/>45<br \/>46<br \/>47<br \/>48<br \/>49<br \/>50<br \/>51<br \/>52<br \/>53<br \/>54<br \/>55<br \/>56<br \/>57<br \/>58<br \/>59<br \/>60<br \/>61<br \/>62<br \/>63<br \/>64<br \/>65<br \/>66<br \/>67<br \/>68<br \/>69<br \/>70<br \/>71<br \/>72<br \/>73<br \/>74<br \/>75<br \/>76<br \/>77<br \/>78<br \/>79<br \/>80<br \/>81<br \/>82<br \/>83<br \/>84<br \/>85<br \/>86<br \/>87<br \/>88<br \/>89<br \/>90<br \/>91<br \/>92<br \/>93<br \/>94<br \/>95<br \/>96<br \/>97<br \/>98<br \/>99<br \/>100<br \/>101<br \/>102<br \/>103<br \/>104<br \/>105<br \/>106<br \/>107<br \/>108<br \/>109<br \/>110<br \/>111<br \/>112<br \/>113<br \/>114<br \/>115<br \/>116<br \/>117<br \/>118<br \/>119<br \/>120<br \/>121<br \/>122<br \/>123<br \/>124<br \/>125<br \/>126<br \/>127<br \/>128<br \/>129<br \/>130<br \/>131<br \/>132<br \/>133<br \/>134<br \/>135<br \/>136<br \/>137<br \/>138<br \/>139<br \/>140<br \/>141<br \/>142<br \/>143<br \/>144<br \/>145<br \/>146<br \/>147<br \/>148<br \/>149<br \/>150<br \/>151<br \/>152<br \/>153<br \/>154<br \/>155<br \/>156<br \/>157<br \/>158<br \/>159<br \/>160<br \/><\/div><\/td><td><div class=\"text codecolorer\">1<br \/>\n2 &nbsp; <br \/>\n3 &nbsp; <br \/>\n4<br \/>\n5<br \/>\n6 &nbsp; &nbsp;<br \/>\n7 &nbsp; &nbsp;<br \/>\n8 &nbsp; &nbsp;<br \/>\n9 &nbsp; &nbsp;&amp;lt;<br \/>\n10 &nbsp; &nbsp;<br \/>\n11 &nbsp; &nbsp;bean <br \/>\n12 &nbsp; &nbsp;<br \/>\n13 &nbsp; &nbsp;id<br \/>\n14 &nbsp; &nbsp;<br \/>\n15 &nbsp; &nbsp;=&amp;quot;incre&amp;quot;<br \/>\n16 &nbsp; &nbsp;<br \/>\n17 &nbsp; &nbsp; class<br \/>\n18 &nbsp; &nbsp;<br \/>\n19 &nbsp; &nbsp;=&amp;quot;org.springframework.jdbc.support.incrementer.MySQLMaxValueIncrementer&amp;quot;<br \/>\n20 &nbsp; &nbsp;<br \/>\n21 &nbsp; &nbsp;&amp;gt;<br \/>\n22 &nbsp; &nbsp;<br \/>\n23 &nbsp; &nbsp; <br \/>\n24 &nbsp; &nbsp;<br \/>\n25 &nbsp; &nbsp;&amp;lt;<br \/>\n26 &nbsp; &nbsp;<br \/>\n27 &nbsp; &nbsp;property <br \/>\n28 &nbsp; &nbsp;<br \/>\n29 &nbsp; &nbsp;name<br \/>\n30 &nbsp; &nbsp;<br \/>\n31 &nbsp; &nbsp;=&amp;quot;incrementerName&amp;quot;<br \/>\n32 &nbsp; &nbsp;<br \/>\n33 &nbsp; &nbsp; value<br \/>\n34 &nbsp; &nbsp;<br \/>\n35 &nbsp; &nbsp;=&amp;quot;t_post_id&amp;quot;<br \/>\n36 &nbsp; &nbsp;<br \/>\n37 &nbsp; &nbsp;\/&amp;gt;<br \/>\n38 &nbsp; &nbsp;<br \/>\n39 &nbsp; &nbsp; \u2460\u8bbe\u7f6e\u7ef4\u62a4\u4e3b\u952e\u7684\u8868\u540d <br \/>\n40 &nbsp; &nbsp;<br \/>\n41 &nbsp; &nbsp;&amp;lt;<br \/>\n42 &nbsp; &nbsp;<br \/>\n43 &nbsp; &nbsp;property <br \/>\n44 &nbsp; &nbsp;<br \/>\n45 &nbsp; &nbsp;name<br \/>\n46 &nbsp; &nbsp;<br \/>\n47 &nbsp; &nbsp;=&amp;quot;columnName&amp;quot;<br \/>\n48 &nbsp; &nbsp;<br \/>\n49 &nbsp; &nbsp; value<br \/>\n50 &nbsp; &nbsp;<br \/>\n51 &nbsp; &nbsp;=&amp;quot;sequence_id&amp;quot;<br \/>\n52 &nbsp; &nbsp;<br \/>\n53 &nbsp; &nbsp;\/&amp;gt;<br \/>\n54 &nbsp; &nbsp;<br \/>\n55 &nbsp; &nbsp;\u2461\u7528\u4e8e\u751f\u6210\u4e3b\u952e\u503c\u7684\u5217\u540d <br \/>\n56 &nbsp; &nbsp;<br \/>\n57 &nbsp; &nbsp;&amp;lt;<br \/>\n58 &nbsp; &nbsp;<br \/>\n59 &nbsp; &nbsp;property <br \/>\n60 &nbsp; &nbsp;<br \/>\n61 &nbsp; &nbsp;name<br \/>\n62 &nbsp; &nbsp;<br \/>\n63 &nbsp; &nbsp;=&amp;quot;cacheSize&amp;quot;<br \/>\n64 &nbsp; &nbsp;<br \/>\n65 &nbsp; &nbsp; value<br \/>\n66 &nbsp; &nbsp;<br \/>\n67 &nbsp; &nbsp;=&amp;quot;10&amp;quot;<br \/>\n68 &nbsp; &nbsp;<br \/>\n69 &nbsp; &nbsp;\/&amp;gt;<br \/>\n70 &nbsp; &nbsp;<br \/>\n71 &nbsp; &nbsp; \u2462\u7f13\u5b58\u5927\u5c0f <br \/>\n72 &nbsp; &nbsp;<br \/>\n73 &nbsp; &nbsp;&amp;lt;<br \/>\n74 &nbsp; &nbsp;<br \/>\n75 &nbsp; &nbsp;property <br \/>\n76 &nbsp; &nbsp;<br \/>\n77 &nbsp; &nbsp;name<br \/>\n78 &nbsp; &nbsp;<br \/>\n79 &nbsp; &nbsp;=&amp;quot;dataSource&amp;quot;<br \/>\n80 &nbsp; &nbsp;<br \/>\n81 &nbsp; &nbsp; ref<br \/>\n82 &nbsp; &nbsp;<br \/>\n83 &nbsp; &nbsp;=&amp;quot;dataSource&amp;quot;<br \/>\n84 &nbsp; &nbsp;<br \/>\n85 &nbsp; &nbsp;\/&amp;gt;<br \/>\n86 &nbsp; &nbsp;<br \/>\n87 &nbsp; &nbsp; <br \/>\n88 &nbsp; &nbsp;<br \/>\n89 &nbsp; &nbsp;&amp;lt;\/<br \/>\n90 &nbsp; &nbsp;<br \/>\n91 &nbsp; &nbsp;bean<br \/>\n92 &nbsp; &nbsp;<br \/>\n93 &nbsp; &nbsp;&amp;gt;<br \/>\n94 &nbsp; &nbsp;<br \/>\n95 &nbsp; &nbsp; <br \/>\n96 &nbsp; &nbsp;<br \/>\n97 &nbsp; &nbsp;&amp;lt;<br \/>\n98 &nbsp; &nbsp;<br \/>\n99 &nbsp; &nbsp;bean <br \/>\n100 &nbsp; &nbsp;<br \/>\n101 &nbsp; &nbsp;id<br \/>\n102 &nbsp; &nbsp;<br \/>\n103 &nbsp; &nbsp;=&amp;quot;postDao&amp;quot;<br \/>\n104 &nbsp; &nbsp;<br \/>\n105 &nbsp; &nbsp; parent<br \/>\n106 &nbsp; &nbsp;<br \/>\n107 &nbsp; &nbsp;=&amp;quot;dao&amp;quot;<br \/>\n108 &nbsp; &nbsp;<br \/>\n109 &nbsp; &nbsp; class<br \/>\n110 &nbsp; &nbsp;<br \/>\n111 &nbsp; &nbsp;=&amp;quot;com.baobaotao.dao.jdbc.PostJdbcDao&amp;quot;<br \/>\n112 &nbsp; &nbsp;<br \/>\n113 &nbsp; &nbsp;&amp;gt;<br \/>\n114 &nbsp; &nbsp;<br \/>\n115 &nbsp; &nbsp; <br \/>\n116 &nbsp; &nbsp;<br \/>\n117 &nbsp; &nbsp;&amp;lt;<br \/>\n118 &nbsp; &nbsp;<br \/>\n119 &nbsp; &nbsp;property <br \/>\n120 &nbsp; &nbsp;<br \/>\n121 &nbsp; &nbsp;name<br \/>\n122 &nbsp; &nbsp;<br \/>\n123 &nbsp; &nbsp;=&amp;quot;lobHandler&amp;quot;<br \/>\n124 &nbsp; &nbsp;<br \/>\n125 &nbsp; &nbsp; ref<br \/>\n126 &nbsp; &nbsp;<br \/>\n127 &nbsp; &nbsp;=&amp;quot;defaultLobHandler&amp;quot;<br \/>\n128 &nbsp; &nbsp;<br \/>\n129 &nbsp; &nbsp;\/&amp;gt;<br \/>\n130 &nbsp; &nbsp;<br \/>\n131 &nbsp; &nbsp; <br \/>\n132 &nbsp; &nbsp;<br \/>\n133 &nbsp; &nbsp;&amp;lt;<br \/>\n134 &nbsp; &nbsp;<br \/>\n135 &nbsp; &nbsp;property <br \/>\n136 &nbsp; &nbsp;<br \/>\n137 &nbsp; &nbsp;name<br \/>\n138 &nbsp; &nbsp;<br \/>\n139 &nbsp; &nbsp;=&amp;quot;incre&amp;quot;<br \/>\n140 &nbsp; &nbsp;<br \/>\n141 &nbsp; &nbsp; ref<br \/>\n142 &nbsp; &nbsp;<br \/>\n143 &nbsp; &nbsp;=&amp;quot;incre&amp;quot;<br \/>\n144 &nbsp; &nbsp;<br \/>\n145 &nbsp; &nbsp;\/&amp;gt;<br \/>\n146 &nbsp; &nbsp;<br \/>\n147 &nbsp; &nbsp; <br \/>\n148 &nbsp; &nbsp;<br \/>\n149 &nbsp; &nbsp;&amp;lt;\/<br \/>\n150 &nbsp; &nbsp;<br \/>\n151 &nbsp; &nbsp;bean<br \/>\n152 &nbsp; &nbsp;<br \/>\n153 &nbsp; &nbsp;&amp;gt;<br \/>\n154 &nbsp; &nbsp;<br \/>\n155 &nbsp; &nbsp; <br \/>\n156 &nbsp; <br \/>\n157 &nbsp; <br \/>\n158<br \/>\n159<br \/>\n160<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n\n<\/pre>\n<p>\u00a0\u00a0\u00a0 incrementerName\u548ccolumnName\u90fd\u5f88\u5bb9\u6613\u7406\u89e3\uff0ccacheSize\u51b3\u5b9a\u4e00\u6b21\u8fd4\u56de\u7684\u4e3b\u952e\u4e2a\u6570\uff0c\u8fd9\u91cc\u6211\u4eec\u8bbe\u7f6e\u4e3a10\u3002\u5f53\u7b2c\u4e00\u6b21\u901a\u8fc7MySQLMaxValueIncrementer# nextIntValue()\u83b7\u53d6\u4e3b\u952e\u503c\u65f6\uff0cMySQLMaxValueIncrementer\u5c06\u4f7ft_post_id. sequence_id\u9012\u589e10\uff0c\u800c\u540e\u7eed9\u6b21\u8c03\u7528nextIntValue()\u65b9\u6cd5\u65f6\uff0c\u90fd\u4ece\u7f13\u5b58\u4e2d\u83b7\u53d6\u4e3b\u952e\u503c\u3002\u76f4\u5230\u7b2c10\u6b21\u518d\u6b21\u8c03\u7528nextIntValue()\u65b9\u6cd5\u65f6\uff0c\u624d\u4f1a\u518d\u6b21\u5c06t_post_id. sequence_id\u5b57\u6bb5\u503c\u9012\u589e10\uff0c\u5982\u6b64\u5faa\u73af\u53cd\u590d\u3002<br \/>\n<strong>\u5c0f\u7ed3<\/strong><br \/>\n<!-- -->\u4e3b\u952e\u7684\u751f\u4ea7\u65b9\u5f0f\u4ece\u4ea7\u751f\u5730\u70b9\u4e0a\u53ef\u4ee5\u5206\u4e3a\u5e94\u7528\u5c42\u4ea7\u751f\u548c\u6570\u636e\u5e93\u4ea7\u751f\u4e24\u79cd\u65b9\u5f0f\u3002\u5e94\u7528\u5c42\u501f\u52a9\u6570\u636e\u5e93\u7684\u5e8f\u5217\u6216\u8868\u4ea7\u751f\u4e3b\u952e\uff0c\u8fd9\u79cd\u65b9\u5f0f\u53ef\u4ee5\u4fdd\u8bc1\u7a0b\u5e8f\u7684\u53ef\u79fb\u690d\u6027\u548c\u5b89\u5168\u6027\uff0c\u540c\u65f6\u53ef\u4ee5\u901a\u8fc7\u7f13\u5b58\u673a\u5236\u63d0\u9ad8\u8fd0\u884c\u6548\u7387\u3002\u6709\u4e9b\u6570\u636e\u5e93\u652f\u6301\u6570\u636e\u8868\u81ea\u589e\u952e\u7684\u4e3b\u952e\u4ea7\u751f\u673a\u5236\uff0c\u5728JDBC 3.0\u4ee5\u524d\u7684\u7248\u672c\u4e2d\uff0c\u65e0\u6cd5\u901a\u8fc7Statement\u81ea\u52a8\u83b7\u53d6\u65b0\u589e\u8bb0\u5f55\u7684\u5bf9\u5e94\u4e3b\u952e\u3002\u8fd9\u65f6\u9700\u8981\u5728\u63d2\u5165\u6570\u636e\u540e\uff0c\u9a6c\u4e0a\u6267\u884c\u4e00\u6761\u6570\u636e\u5e93\u76f8\u5173\u7684\u4e3b\u952e\u83b7\u53d6SQL\u8bed\u53e5\u4ee5\u5f97\u5230\u5bf9\u5e94\u7684\u4e3b\u952e\u503c\uff0c\u5728\u6570\u636e\u5e93\u9ad8\u5e76\u53d1\u7684\u60c5\u51b5\u4e0b\uff0c\u6709\u53ef\u80fd\u83b7\u53d6\u5230\u4e0d\u6b63\u786e\u7684\u4e3b\u952e\u503c\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u5728\u63d2\u5165\u6570\u636e\u524d\u4e8b\u5148\u5728\u5e94\u7528\u5c42\u51c6\u5907\u597d\u4e3b\u952e\u503c\u662f\u5f88\u597d\u7684\u5907\u9009\u65b9\u6848\u3002<\/p>\n<p>\u00a0<\/p>\n<p>jdbcTemplate<\/p>\n<p>\u00a0<\/p>\n<p>\/**\u00a0 * \u6839\u636e\u6e20\u9053\u6dfb\u52a0\u7528\u6237\u00a0 * @param login\u00a0 * @return \u00a0 *\/\u00a0public int addUser(final UserLogin login){\u00a0\u00a0final String INSERT_USER_LOGIN = &quot;insert into user_login(businessid,username,password,channelsid,lasttime) values (?,?,?,?,now())&quot;;\u00a0\u00a0\u00a0\u00a0 KeyHolder keyHolder = new GeneratedKeyHolder();\u00a0\u00a0 \u00a0\u00a0jdbcTemplate.update(new PreparedStatementCreator() {\u00a0\u00a0 \u00a0\u00a0public PreparedStatement createPreparedStatement(Connection connection) \u00a0\u00a0throws SQLException {\u00a0\u00a0\u00a0PreparedStatement ps = connection.prepareStatement(INSERT_USER_LOGIN,\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0 new String[] { &quot;id&quot; });\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0 ps.setString(1, login.getBusinessid());\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0 ps.setString(2, login.getUsername()); \u00a0\u00a0\u00a0\u00a0\u00a0 ps.setString(3, login.getPassword()); \u00a0\u00a0\u00a0\u00a0\u00a0 ps.setString(4, login.getChannelsid());\u00a0\u00a0\u00a0\u00a0\u00a0 return ps;\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0 }\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0 }, keyHolder);\u00a0\u00a0 \u00a0\u00a0return keyHolder.getKey().intValue();\u00a0}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u4e00\u822c\u60c5\u51b5\u4e0b\uff0c\u5728\u65b0\u589e\u9886\u57df\u5bf9\u8c61\u540e\uff0c\u90fd\u9700\u8981\u83b7\u53d6\u5bf9\u5e94\u7684\u4e3b\u952e\u503c\u3002\u4f7f\u7528\u5e94\u7528\u5c42\u6765\u7ef4\u62a4\u4e3b\u952e\uff0c\u5728\u4e00\u5b9a\u7a0b\u5ea6\u4e0a\u6709\u5229\u4e8e\u7a0b\u5e8f\u6027\u80fd\u7684\u4f18\u5316\u548c\u5e94\u7528\u79fb\u690d\u6027\u7684\u63d0\u9ad8\u3002\u5728\u91c7\u7528\u6570\u636e\u5e93\u81ea\u589e\u4e3b\u952e\u7684\u65b9\u6848\u91cc\uff0c\u5982\u679cJDBC\u9a71\u52a8\u4e0d\u80fd\u7ed1\u5b9a\u65b0\u589e\u8bb0\u5f55\u5bf9\u5e94\u7684\u4e3b\u952e\uff0c\u5c31\u9700\u8981\u624b\u5de5\u6267\u884c\u67e5\u8be2\u8bed\u53e5\u4ee5\u83b7\u53d6\u5bf9\u5e94\u7684\u4e3b\u952e\u503c\uff0c\u5bf9\u4e8e\u9ad8\u5e76\u53d1\u7684\u7cfb\u7edf\uff0c\u8fd9\u5f88\u5bb9\u6613\u8fd4\u56de\u9519\u8bef\u7684\u4e3b\u952e\u3002\u901a\u8fc7\u5e26\u7f13\u5b58\u7684DataFieldMaxValueIncrementer\uff0c\u53ef\u4ee5\u4e00\u6b21\u83b7\u53d6\u6279\u91cf\u7684\u4e3b\u952e\u503c\uff0c\u4f9b\u591a\u6b21\u63d2\u5165\u9886\u57df\u5bf9\u8c61\u65f6\u4f7f\u7528\uff0c\u5b83\u7684\u6267\u884c\u6027\u80fd\u662f\u5f88\u9ad8\u7684\u3002 \u4f7f\u7528\u6570\u636e\u5e93\u7684\u81ea\u589e\u4e3b\u952e \u6211\u4eec\u7ecf\u5e38\u4f7f\u7528\u6570\u636e\u7684\u81ea\u589e\u5b57\u6bb5\u4f5c\u4e3a\u8868\u4e3b\u952e\uff0c\u4e5f\u5373\u4e3b\u952e\u503c\u4e0d\u5728\u5e94\u7528\u5c42\u4ea7\u751f\uff0c<\/p>\n","protected":false},"author":1,"featured_media":6522,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[2],"tags":[292,9,21,500,20],"collection":[],"_links":{"self":[{"href":"https:\/\/aqzt.com\/wp-json\/wp\/v2\/posts\/24232"}],"collection":[{"href":"https:\/\/aqzt.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aqzt.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aqzt.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/aqzt.com\/wp-json\/wp\/v2\/comments?post=24232"}],"version-history":[{"count":0,"href":"https:\/\/aqzt.com\/wp-json\/wp\/v2\/posts\/24232\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/aqzt.com\/wp-json\/wp\/v2\/media\/6522"}],"wp:attachment":[{"href":"https:\/\/aqzt.com\/wp-json\/wp\/v2\/media?parent=24232"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aqzt.com\/wp-json\/wp\/v2\/categories?post=24232"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aqzt.com\/wp-json\/wp\/v2\/tags?post=24232"},{"taxonomy":"collection","embeddable":true,"href":"https:\/\/aqzt.com\/wp-json\/wp\/v2\/collection?post=24232"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}