{"id":977,"date":"2023-03-11T17:22:01","date_gmt":"2023-03-11T09:22:01","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=977"},"modified":"2023-04-29T15:47:19","modified_gmt":"2023-04-29T07:47:19","slug":"java-lang-unsupportedoperationexception-in-mybatis-solution","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/11\/java-lang-unsupportedoperationexception-in-mybatis-solution\/","title":{"rendered":"MyBatis\u4e4bjava.lang.UnsupportedOperationException\u5f02\u5e38\u89e3\u51b3\u65b9\u6848"},"content":{"rendered":"<p>\u4eca\u5929\u5728\u4f7f\u7528MyBatis\u6267\u884csql\u8bed\u53e5\u65f6\uff0c\u51fa\u73b0\u5982\u4e0b\u5f02\u5e38\uff1a<\/p>\n<p>\u6267\u884c\u7684sql\u8bed\u53e5\u914d\u7f6e\u4fe1\u606f\u5982\u4e0b\uff1a<\/p>\n<pre><code>&lt;select id=&quot;getColumnsByTableName&quot; parameterType=&quot;String&quot; resultType=&quot;java.util.List&quot;&gt;\n    select t.column_name from user_tab_columns t where t.tableName=#{tableName,jdbcType=VARCHAR}\n&lt;\/select&gt;<\/code><\/pre>\n<p>\u5bf9\u5e94\u7684dao\u63a5\u53e3\u4ee3\u7801\u4e3a\uff1a<\/p>\n<pre><code>public List&lt;String&gt; getColumnsByTableName(String tableName);<\/code><\/pre>\n<p>\u5e94\u8be5\u6539\u4e3a\uff1a<\/p>\n<pre><code>&lt;select id=&quot;getColumnsByTableName&quot; parameterType=&quot;String&quot; resultType=&quot;String&quot;&gt;      \n    select t.column_name from user_tab_columns t where t.tableName=#{tableName,jdbcType=VARCHAR}\n&lt;\/select&gt;<\/code><\/pre>\n<p>\u539f\u56e0\u5c31\u5728\u4e8e<code>resultType<\/code>\u4ee3\u8868\u7684\u662fList\u4e2d\u7684\u5143\u7d20\u7c7b\u578b\uff0c\u800c\u4e0d\u5e94\u8be5\u662fList\u672c\u8eab\uff0c\u7a76\u5176\u539f\u56e0\u5c31\u5728\u4e8e\u88abdao\u4e2d\u7684\u65b9\u6cd5\u58f0\u660e<\/p>\n<pre><code>public List getColumnsByTableName(String tableName);<\/code><\/pre>\n<p>\u7ed9\u8ff7\u60d1\u4f4f\u4e86<\/p>\n<p>\u5207\u8bb0\uff1a<code>resultType<\/code>\u8fd4\u56de\u7684\u662f\u96c6\u5408\u4e2d\u7684\u5143\u7d20\u7c7b\u578b\uff0c\u800c\u4e0d\u662f\u96c6\u5408\u672c\u8eab<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u5929\u5728\u4f7f\u7528MyBatis\u6267\u884csql\u8bed\u53e5\u65f6\uff0c\u51fa\u73b0\u5982\u4e0b\u5f02\u5e38\uff1a \u6267\u884c\u7684sql\u8bed\u53e5\u914d\u7f6e\u4fe1\u606f\u5982\u4e0b\uff1a &lt;select [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-977","post","type-post","status-publish","format-standard","hentry","category-mybatis"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/977","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=977"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/977\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=977"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=977"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=977"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}