{"id":121970,"date":"2026-11-04T03:48:50","date_gmt":"2026-11-03T19:48:50","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/121970.html"},"modified":"2026-11-04T03:48:50","modified_gmt":"2026-11-03T19:48:50","slug":"%e6%b2%a1%e5%86%99-transactional%ef%bc%8c%e4%ba%8b%e5%8a%a1%e5%b0%b1%e4%b8%8d%e7%94%9f%e6%95%88%ef%bc%9f%e4%bb%8e%e4%b8%80%e6%ac%a1%e7%b4%a2%e5%bc%95%e9%87%8d%e5%bb%ba%e7%9c%8b%e6%87%82%e4%ba%8b","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/121970.html","title":{"rendered":"\u6ca1\u5199 @Transactional\uff0c\u4e8b\u52a1\u5c31\u4e0d\u751f\u6548\uff1f\u4ece\u4e00\u6b21\u7d22\u5f15\u91cd\u5efa\u770b\u61c2\u4e8b\u52a1\u8fb9\u754c"},"content":{"rendered":"<h2>\u6ca1\u5199 &#064;Transactional&#xff0c;\u4e8b\u52a1\u5c31\u4e0d\u751f\u6548&#xff1f;\u4ece\u4e00\u6b21\u7d22\u5f15\u91cd\u5efa\u770b\u61c2\u4e8b\u52a1\u8fb9\u754c<\/h2>\n<p>\u65b9\u6cd5\u91cc\u6709\u63d0\u4ea4\u548c\u56de\u6eda&#xff0c;\u4e0d\u4ee3\u8868\u6574\u4e2a\u4e1a\u52a1\u6d41\u7a0b\u90fd\u80fd\u4e00\u8d77\u56de\u6eda\u3002\u5224\u65ad\u4e8b\u52a1\u662f\u5426\u6709\u6548&#xff0c;\u9700\u8981\u6cbf\u8c03\u7528\u94fe\u627e\u5230\u771f\u6b63\u7684\u63d0\u4ea4\u8fb9\u754c\u3002<\/p>\n<p>\u672c\u6587\u4ece\u77e5\u8bc6\u5e93\u4e2d\u7684 PaiCLI \u9605\u8bfb\u7b14\u8bb0\u51fa\u53d1&#xff0c;\u91cd\u65b0\u6838\u5bf9\u4e86\u5f53\u524d\u672c\u5730\u6e90\u7801\u3002\u9879\u76ee\u4f7f\u7528 Java 17\u3001SQLite JDBC&#xff0c;\u672a\u4f7f\u7528 Spring&#xff1b;Spring \u90e8\u5206\u7528\u4e8e\u673a\u5236\u5bf9\u7167\u3002\u6587\u4e2d\u7684\u5931\u8d25\u7ed3\u679c\u662f\u57fa\u4e8e\u4ee3\u7801\u7684\u5206\u6790&#xff0c;\u6539\u9020\u7ed3\u6784\u662f\u8bbe\u8ba1\u793a\u610f&#xff0c;\u5747\u672a\u8fdb\u884c\u6545\u969c\u6ce8\u5165\u5b9e\u6d4b\u3002<\/p>\n<p>\u8bfb PaiCLI \u7684\u4ee3\u7801\u7d22\u5f15\u6a21\u5757\u65f6&#xff0c;\u6211\u6ce8\u610f\u5230\u4e00\u4e2a\u7ec6\u8282&#xff1a;insertChunks() \u7684\u6ce8\u91ca\u5199\u7740\u201c\u4e8b\u52a1\u4fdd\u62a4\u201d&#xff0c;\u65b9\u6cd5\u4e0a\u5374\u6ca1\u6709 &#064;Transactional\u3002<\/p>\n<p>\u5982\u679c\u4e60\u60ef\u4e86 Spring Boot&#xff0c;\u5f88\u5bb9\u6613\u5148\u53bb\u627e\u4e8b\u52a1\u6ce8\u89e3\u3002\u4f46\u8fd9\u4e2a\u9879\u76ee\u901a\u8fc7 JDBC \u76f4\u63a5\u64cd\u4f5c SQLite&#xff0c;\u4e8b\u52a1\u63a7\u5236\u5c31\u5199\u5728\u65b9\u6cd5\u5185\u90e8\u3002<\/p>\n<p>\u7ee7\u7eed\u5f80\u8c03\u7528\u5904\u770b&#xff0c;\u66f4\u503c\u5f97\u8ffd\u95ee\u7684\u4e8b\u60c5\u51fa\u73b0\u4e86&#xff1a;\u6e05\u7406\u65e7\u7d22\u5f15\u3001\u63d2\u5165\u65b0\u4ee3\u7801\u5757\u3001\u63d2\u5165\u4ee3\u7801\u5173\u7cfb&#xff0c;\u662f\u4e0d\u662f\u4e00\u4e2a\u6574\u4f53&#xff1f;\u5982\u679c\u6700\u540e\u4e00\u6b65\u5931\u8d25&#xff0c;\u524d\u9762\u7684\u64cd\u4f5c\u8fd8\u80fd\u6062\u590d\u5417&#xff1f;<\/p>\n<h3>\u4e00\u3001\u5148\u770b\u9879\u76ee\u600e\u4e48\u64cd\u4f5c\u6570\u636e\u5e93<\/h3>\n<p>PaiCLI \u7684 VectorStore \u76f4\u63a5\u5efa\u7acb JDBC \u8fde\u63a5&#xff0c;\u76f8\u5173\u8bed\u53e5\u5982\u4e0b&#xff1a;<\/p>\n<p><span class=\"token keyword\">this<\/span><span class=\"token punctuation\">.<\/span>connection <span class=\"token operator\">&#061;<\/span> <span class=\"token class-name\">DriverManager<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">getConnection<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;jdbc:sqlite:&#034;<\/span> <span class=\"token operator\">&#043;<\/span> dbPath<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u5b83\u7ef4\u62a4\u4e24\u5f20\u8868&#xff1a;code_chunks \u5b58\u4ee3\u7801\u5757\u53ca\u5176\u5411\u91cf&#xff0c;code_relations \u5b58\u4ee3\u7801\u4e4b\u95f4\u7684\u5173\u7cfb\u3002<\/p>\n<p>\u5728\u5f53\u524d\u7684 CodeIndex.index() \u4e2d&#xff0c;\u6301\u4e45\u5316\u90e8\u5206\u4f9d\u6b21\u8c03\u7528\u4ee5\u4e0b\u65b9\u6cd5\u3002\u4e0b\u9762\u8282\u9009\u8c03\u7528\u987a\u5e8f&#xff0c;\u7701\u7565\u7edf\u8ba1\u548c\u65e5\u5fd7&#xff1a;<\/p>\n<p><span class=\"token keyword\">try<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token class-name\">VectorStore<\/span> store <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">VectorStore<\/span><span class=\"token punctuation\">(<\/span>root<span class=\"token punctuation\">.<\/span><span class=\"token function\">toString<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    store<span class=\"token punctuation\">.<\/span><span class=\"token function\">clearProject<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    store<span class=\"token punctuation\">.<\/span><span class=\"token function\">insertChunks<\/span><span class=\"token punctuation\">(<\/span>entries<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    store<span class=\"token punctuation\">.<\/span><span class=\"token function\">insertRelations<\/span><span class=\"token punctuation\">(<\/span>allRelations<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token comment\">\/\/ \u540e\u7eed\u7edf\u8ba1\u548c\u7ed3\u679c\u5904\u7406\u7701\u7565<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u4ece\u4e1a\u52a1\u4e0a\u770b&#xff0c;\u8fd9\u662f\u4e00\u6b21\u91cd\u5efa&#xff1a;\u5148\u6e05\u6389\u5f53\u524d\u9879\u76ee\u7684\u65e7\u6570\u636e&#xff0c;\u518d\u5199\u5165\u65b0\u6570\u636e\u3002<\/p>\n<p>\u4f46\u540c\u4e00\u4e2a try \u5757\u3001\u540c\u4e00\u4e2a\u5bf9\u8c61&#xff0c;\u751a\u81f3\u540c\u4e00\u4e2a\u8fde\u63a5&#xff0c;\u90fd\u4e0d\u80fd\u5355\u72ec\u8bc1\u660e\u8fd9\u4e09\u6b65\u5c5e\u4e8e\u540c\u4e00\u4e2a\u4e8b\u52a1\u3002<\/p>\n<h3>\u4e8c\u3001\u6ca1\u6709\u6ce8\u89e3&#xff0c;\u4e8b\u52a1\u63a7\u5236\u5728\u54ea\u91cc&#xff1f;<\/h3>\n<p>insertChunks() \u7684\u5173\u952e\u7ed3\u6784\u5982\u4e0b\u3002\u8fd9\u662f\u6e90\u7801\u8282\u9009&#xff0c;\u7701\u7565\u4e86 SQL \u5b9a\u4e49\u53ca\u90e8\u5206\u53c2\u6570\u7ed1\u5b9a&#xff0c;\u4e0d\u662f\u53ef\u72ec\u7acb\u8fd0\u884c\u7684\u5b8c\u6574\u65b9\u6cd5&#xff1a;<\/p>\n<p><span class=\"token keyword\">boolean<\/span> autoCommit <span class=\"token operator\">&#061;<\/span> connection<span class=\"token punctuation\">.<\/span><span class=\"token function\">getAutoCommit<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\nconnection<span class=\"token punctuation\">.<\/span><span class=\"token function\">setAutoCommit<\/span><span class=\"token punctuation\">(<\/span><span class=\"token boolean\">false<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">try<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token class-name\">PreparedStatement<\/span> ps <span class=\"token operator\">&#061;<\/span> connection<span class=\"token punctuation\">.<\/span><span class=\"token function\">prepareStatement<\/span><span class=\"token punctuation\">(<\/span>sql<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">for<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token class-name\">CodeChunkEntry<\/span> entry <span class=\"token operator\">:<\/span> entries<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        ps<span class=\"token punctuation\">.<\/span><span class=\"token function\">setString<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">,<\/span> projectPath<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token comment\">\/\/ \u4e2d\u95f4\u53c2\u6570\u7ed1\u5b9a\u7701\u7565<\/span><br \/>\n        ps<span class=\"token punctuation\">.<\/span><span class=\"token function\">setString<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">6<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token function\">embeddingToJson<\/span><span class=\"token punctuation\">(<\/span>entry<span class=\"token punctuation\">.<\/span>embedding<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        ps<span class=\"token punctuation\">.<\/span><span class=\"token function\">addBatch<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n    ps<span class=\"token punctuation\">.<\/span><span class=\"token function\">executeBatch<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    connection<span class=\"token punctuation\">.<\/span><span class=\"token function\">commit<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span> <span class=\"token keyword\">catch<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token class-name\">SQLException<\/span> e<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    connection<span class=\"token punctuation\">.<\/span><span class=\"token function\">rollback<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token keyword\">throw<\/span> e<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span> <span class=\"token keyword\">finally<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    connection<span class=\"token punctuation\">.<\/span><span class=\"token function\">setAutoCommit<\/span><span class=\"token punctuation\">(<\/span>autoCommit<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u8fd9\u91cc\u5df2\u7ecf\u5305\u542b\u4e86 JDBC \u624b\u52a8\u4e8b\u52a1\u7684\u4e3b\u8981\u52a8\u4f5c&#xff1a;\u5173\u95ed\u81ea\u52a8\u63d0\u4ea4\u3001\u6267\u884c SQL\u3001\u6210\u529f\u65f6\u63d0\u4ea4\u3001\u6355\u83b7\u6307\u5b9a\u5f02\u5e38\u65f6\u56de\u6eda&#xff0c;\u6700\u540e\u6062\u590d\u8fde\u63a5\u72b6\u6001\u3002<\/p>\n<p>setAutoCommit(false) \u7684\u542b\u4e49\u662f\u5173\u95ed\u81ea\u52a8\u63d0\u4ea4&#xff1b;\u6570\u636e\u5e93\u5b9e\u9645\u4f55\u65f6\u5efa\u7acb\u4e8b\u52a1&#xff0c;\u8fd8\u4e0e\u6570\u636e\u5e93\u548c\u9a71\u52a8\u6709\u5173&#xff0c;\u4e0d\u5fc5\u628a\u5b83\u673a\u68b0\u7b49\u540c\u4e8e\u7acb\u5373\u6267\u884c\u4e86\u4e00\u6761 BEGIN\u3002<\/p>\n<p>commit() \u548c rollback() \u4f5c\u7528\u4e8e\u8fde\u63a5\u4e0a\u7684\u5f53\u524d\u4e8b\u52a1&#xff0c;\u4e0d\u662f\u6309 Java \u65b9\u6cd5\u540d\u5212\u5206\u8303\u56f4\u3002Java 17 Connection \u6587\u6863<\/p>\n<p>\u6240\u4ee5&#xff0c;\u6ca1\u5199 &#064;Transactional&#xff0c;\u5e76\u4e0d\u610f\u5473\u7740\u6ca1\u6709\u4e8b\u52a1\u3002\u8fd9\u4e2a\u9879\u76ee\u9009\u62e9\u7531\u4ee3\u7801\u76f4\u63a5\u63a7\u5236\u6570\u636e\u5e93\u4e8b\u52a1\u3002<\/p>\n<p>\u8fd8\u6709\u4e00\u4e2a\u5bb9\u6613\u6df7\u6dc6\u7684\u70b9&#xff1a;addBatch() \u7528\u4e8e\u79ef\u7d2f\u6279\u5904\u7406&#xff0c;executeBatch() \u7528\u4e8e\u63d0\u4ea4\u6267\u884c&#xff0c;\u6279\u5904\u7406\u672c\u8eab\u4e0d\u63d0\u4f9b\u6574\u6279\u539f\u5b50\u6027\u7684\u4fdd\u8bc1\u3002\u9a71\u52a8\u5728\u90e8\u5206\u547d\u4ee4\u5931\u8d25\u540e&#xff0c;\u53ef\u80fd\u7ee7\u7eed\u6267\u884c\u5269\u4f59\u547d\u4ee4&#xff0c;\u4e5f\u53ef\u80fd\u505c\u6b62&#xff1b;\u4e0d\u80fd\u628a\u4e00\u6b21\u6279\u5904\u7406\u8c03\u7528\u7406\u89e3\u6210\u4e00\u6b21\u7f51\u7edc\u53d1\u9001\u6216\u4e00\u4e2a\u5929\u7136\u7684\u4e8b\u52a1\u3002Java 17 Statement \u6587\u6863<\/p>\n<h3>\u4e09\u3001\u6bcf\u4e2a\u65b9\u6cd5\u6709\u4e8b\u52a1&#xff0c;\u4e3a\u4ec0\u4e48\u91cd\u5efa\u4ecd\u53ef\u80fd\u53ea\u5b8c\u6210\u4e00\u534a&#xff1f;<\/h3>\n<p>\u5148\u770b clearProject()\u3002\u5b83\u987a\u5e8f\u6267\u884c\u4e24\u6761\u5220\u9664&#xff1a;<\/p>\n<p>ps1<span class=\"token punctuation\">.<\/span><span class=\"token function\">executeUpdate<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u5220\u9664\u5f53\u524d\u9879\u76ee\u7684\u4ee3\u7801\u5757<\/span><br \/>\nps2<span class=\"token punctuation\">.<\/span><span class=\"token function\">executeUpdate<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u5220\u9664\u5f53\u524d\u9879\u76ee\u7684\u4ee3\u7801\u5173\u7cfb<\/span><\/p>\n<p>\u8fd9\u4e2a\u65b9\u6cd5\u6ca1\u6709\u81ea\u884c\u5173\u95ed\u81ea\u52a8\u63d0\u4ea4\u3002\u6cbf\u5f53\u524d\u8c03\u7528\u94fe&#xff0c;\u65b0\u8fde\u63a5\u4fdd\u6301\u9ed8\u8ba4\u81ea\u52a8\u63d0\u4ea4\u6a21\u5f0f&#xff0c;\u56e0\u6b64\u4e24\u6761\u5220\u9664\u5206\u522b\u63d0\u4ea4&#xff0c;\u8fde\u201c\u6e05\u7406\u65e7\u7d22\u5f15\u201d\u8fd9\u4e00\u6b65\u90fd\u6ca1\u6709\u88ab\u7edf\u4e00\u5305\u6210\u4e00\u4e2a\u4e8b\u52a1\u3002<\/p>\n<p>\u968f\u540e&#xff0c;insertChunks() \u548c insertRelations() \u5206\u522b\u5173\u95ed\u81ea\u52a8\u63d0\u4ea4&#xff0c;\u5e76\u5404\u81ea\u6267\u884c commit()\u3002<\/p>\n<p>\u6b63\u5e38\u8def\u5f84\u4e0b&#xff0c;\u53ef\u4ee5\u8fd9\u6837\u7406\u89e3\u8fd9\u4e9b\u63d0\u4ea4\u8fb9\u754c&#xff1a;<\/p>\n<p>\u5220\u9664\u65e7\u4ee3\u7801\u5757 \u2192 \u63d0\u4ea4<br \/>\n\u5220\u9664\u65e7\u4ee3\u7801\u5173\u7cfb \u2192 \u63d0\u4ea4<br \/>\n\u63d2\u5165\u65b0\u4ee3\u7801\u5757 \u2192 \u63d0\u4ea4<br \/>\n\u63d2\u5165\u65b0\u4ee3\u7801\u5173\u7cfb \u2192 \u63d0\u4ea4<\/p>\n<p>\u5047\u8bbe\u65e7\u6570\u636e\u5df2\u7ecf\u5220\u9664\u5e76\u63d0\u4ea4&#xff0c;\u63d2\u5165\u65b0\u4ee3\u7801\u5757\u65f6\u9047\u5230 SQL \u5f02\u5e38&#xff0c;\u5373\u4f7f\u8be5\u6279\u63d2\u5165\u6210\u529f\u56de\u6eda&#xff0c;\u65e7\u6570\u636e\u4e5f\u4e0d\u4f1a\u968f\u4e4b\u6062\u590d\u3002<\/p>\n<p>\u518d\u5047\u8bbe\u4ee3\u7801\u5757\u5df2\u7ecf\u63d2\u5165\u5e76\u63d0\u4ea4&#xff0c;\u5173\u7cfb\u63d2\u5165\u5931\u8d25\u5e76\u56de\u6eda&#xff0c;\u53ef\u80fd\u7559\u4e0b\u201c\u65b0\u4ee3\u7801\u5757\u5df2\u5b58\u5728&#xff0c;\u5173\u7cfb\u6ca1\u6709\u5199\u5165\u201d\u7684\u72b6\u6001\u3002<\/p>\n<p>\u8fd9\u4e9b\u90fd\u662f\u6309\u5f53\u524d\u4ee3\u7801\u63a8\u5bfc\u7684\u5931\u8d25\u573a\u666f&#xff0c;\u4e0d\u662f\u4e00\u6b21\u5df2\u7ecf\u590d\u73b0\u7684\u6570\u636e\u4e22\u5931\u4e8b\u6545\u3002<\/p>\n<p>\u5c40\u90e8\u4e8b\u52a1\u80fd\u56de\u6eda\u7684&#xff0c;\u662f\u5b83\u5f53\u524d\u5c1a\u672a\u63d0\u4ea4\u7684\u5de5\u4f5c&#xff1b;\u5b83\u4e0d\u80fd\u64a4\u9500\u524d\u9762\u5df2\u7ecf\u63d0\u4ea4\u7684\u4e8b\u52a1\u3002 <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261103194847-6aea3a9ff1a93.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u56fe&#xff1a;\u524d\u4e09\u6b65\u5df2\u5206\u522b\u63d0\u4ea4\u65f6&#xff0c;\u540e\u7eed\u56de\u6eda\u65e0\u6cd5\u64a4\u9500\u5b83\u4eec&#xff1b;\u7edf\u4e00\u4e8b\u52a1\u65b9\u6848\u5728\u56de\u6eda\u6210\u529f\u65f6\u53ef\u64a4\u9500\u672c\u6b21\u6570\u636e\u5e93\u4fee\u6539\u3002\u4e0b\u534a\u90e8\u5206\u4e3a\u6539\u9020\u793a\u610f&#xff0c;\u975e\u6545\u969c\u5b9e\u6d4b\u3002<\/p>\n<h3>\u56db\u3001\u4e3a\u4ec0\u4e48\u4e0d\u80fd\u53ea\u5728\u5916\u9762\u518d\u5957\u4e00\u5c42\u4e8b\u52a1&#xff1f;<\/h3>\n<p>\u770b\u5230\u8fd9\u91cc&#xff0c;\u4e00\u4e2a\u76f4\u89c9\u65b9\u6848\u662f&#xff1a;\u5728\u5916\u5c42\u5173\u95ed\u81ea\u52a8\u63d0\u4ea4&#xff0c;\u7136\u540e\u7ee7\u7eed\u8c03\u7528\u539f\u6765\u7684\u4e09\u4e2a\u65b9\u6cd5&#xff0c;\u6700\u540e\u7edf\u4e00\u63d0\u4ea4\u3002<\/p>\n<p>\u95ee\u9898\u5728\u4e8e&#xff0c;\u5185\u90e8 insertChunks() \u4ecd\u7136\u4f1a\u6267\u884c&#xff1a;<\/p>\n<p>connection<span class=\"token punctuation\">.<\/span><span class=\"token function\">commit<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u5982\u679c\u4f7f\u7528\u540c\u4e00\u4e2a\u8fde\u63a5&#xff0c;\u5b83\u63d0\u4ea4\u7684\u662f\u8fd9\u4e2a\u8fde\u63a5\u4e0a\u5f53\u524d\u4e8b\u52a1\u4e2d\u7684\u5168\u90e8\u5de5\u4f5c&#xff0c;\u53ef\u80fd\u8fde\u524d\u9762\u7684\u5220\u9664\u4e00\u8d77\u63d0\u4ea4\u3002\u540e\u7eed\u63d2\u5165\u5173\u7cfb\u5931\u8d25&#xff0c;\u5916\u5c42\u518d\u56de\u6eda\u4e5f\u65e0\u6cd5\u64a4\u9500\u5df2\u7ecf\u63d0\u4ea4\u7684\u90e8\u5206\u3002<\/p>\n<p>\u56e0\u6b64&#xff0c;\u6539\u9020\u7684\u5173\u952e\u662f\u660e\u786e\u4e8b\u52a1\u7684\u62e5\u6709\u8005\u3002\u4e0b\u9762\u662f\u804c\u8d23\u5212\u5206\u793a\u610f&#xff0c;\u5176\u4e2d\u7684 &#8230;SqlOnly \u65b9\u6cd5\u9700\u8981\u65b0\u5b9e\u73b0&#xff0c;\u5e76\u975e\u9879\u76ee\u5df2\u6709 API&#xff1a;<\/p>\n<p>rebuildIndex&#xff1a;\u552f\u4e00\u8d1f\u8d23\u4e8b\u52a1\u8fb9\u754c<br \/>\n  \u5173\u95ed\u81ea\u52a8\u63d0\u4ea4<br \/>\n  \u6267\u884c clearProjectSqlOnly<br \/>\n  \u6267\u884c insertChunksSqlOnly<br \/>\n  \u6267\u884c insertRelationsSqlOnly<br \/>\n  \u5168\u90e8\u6210\u529f&#xff1a;\u63d0\u4ea4<br \/>\n  \u63d0\u4ea4\u524d\u53d1\u751f\u5931\u8d25&#xff1a;\u5c1d\u8bd5\u56de\u6eda&#xff0c;\u5411\u4e0a\u4f20\u9012\u9519\u8bef<\/p>\n<p>\u5e95\u5c42 SQL \u65b9\u6cd5\u5fc5\u987b\u4f7f\u7528\u540c\u4e00\u4e2a\u53d7\u63a7\u8fde\u63a5&#xff0c;\u5e76\u4e14\u4e0d\u518d\u81ea\u884c\u63d0\u4ea4\u3001\u56de\u6eda\u6216\u5207\u6362\u81ea\u52a8\u63d0\u4ea4\u6a21\u5f0f\u3002\u5982\u679c\u5b83\u4eec\u9700\u8981\u72ec\u7acb\u8c03\u7528&#xff0c;\u53ef\u4ee5\u53e6\u5916\u63d0\u4f9b\u62e5\u6709\u4e8b\u52a1\u8fb9\u754c\u7684\u5165\u53e3\u3002<\/p>\n<p>\u843d\u5730\u65f6\u8fd8\u8981\u660e\u786e&#xff1a;\u8fd9\u4e2a\u5165\u53e3\u662f\u72ec\u5360\u4e00\u6761\u65b0\u8fde\u63a5&#xff0c;\u8fd8\u662f\u5141\u8bb8\u52a0\u5165\u8c03\u7528\u8005\u5df2\u6709\u7684\u4e8b\u52a1&#xff1f;\u4e24\u79cd\u5951\u7ea6\u4e0d\u80fd\u542b\u6df7\u3002\u5bf9\u4e0d\u652f\u6301\u4e8b\u52a1\u5d4c\u5957\u7684\u7b80\u5355\u5b9e\u73b0&#xff0c;\u53ef\u4ee5\u62d2\u7edd\u63a5\u6536\u5df2\u7ecf\u5904\u4e8e\u624b\u52a8\u4e8b\u52a1\u6a21\u5f0f\u7684\u8fde\u63a5&#xff0c;\u800c\u4e0d\u662f\u64c5\u81ea\u63d0\u4ea4\u8c03\u7528\u8005\u7684\u5de5\u4f5c\u3002<\/p>\n<p>\u6062\u590d\u8fde\u63a5\u72b6\u6001\u4e4b\u524d&#xff0c;\u4e5f\u5fc5\u987b\u5904\u7406\u597d\u4e8b\u52a1\u7ed3\u675f\u548c\u56de\u6eda\u5931\u8d25\u3002\u628a\u81ea\u52a8\u63d0\u4ea4\u4ece false \u6539\u4e3a true \u53ef\u80fd\u63d0\u4ea4\u5f53\u524d\u4e8b\u52a1&#xff0c;\u4e0d\u80fd\u628a finally \u4e2d\u7684\u72b6\u6001\u6062\u590d\u5f53\u6210\u56de\u6eda\u7684\u66ff\u4ee3\u54c1\u3002Connection.setAutoCommit \u6587\u6863<\/p>\n<h3>\u4e94\u3001\u6362\u6210 Spring&#xff0c;\u5c31\u53ea\u9700\u8981\u4e00\u4e2a\u6ce8\u89e3\u5417&#xff1f;<\/h3>\n<p>\u5728 Spring \u5e94\u7528\u4e2d&#xff0c;\u58f0\u660e\u5f0f\u4e8b\u52a1\u53ef\u4ee5\u5e2e\u52a9\u7ba1\u7406\u8fb9\u754c\u3002\u6bd4\u5982&#xff0c;\u4e0b\u9762\u662f\u4e00\u6bb5\u72ec\u7acb\u7684\u8bbe\u8ba1\u793a\u610f&#xff0c;\u5e76\u975e PaiCLI \u73b0\u6709\u5b9e\u73b0&#xff1a;<\/p>\n<p><span class=\"token annotation punctuation\">&#064;Transactional<\/span><span class=\"token punctuation\">(<\/span>rollbackFor <span class=\"token operator\">&#061;<\/span> <span class=\"token class-name\">Exception<\/span><span class=\"token punctuation\">.<\/span><span class=\"token keyword\">class<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token keyword\">public<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">rebuildIndex<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    repository<span class=\"token punctuation\">.<\/span><span class=\"token function\">clearProject<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    repository<span class=\"token punctuation\">.<\/span><span class=\"token function\">insertChunks<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    repository<span class=\"token punctuation\">.<\/span><span class=\"token function\">insertRelations<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u8fd9\u6bb5\u793a\u610f\u6210\u7acb&#xff0c;\u9700\u8981\u4e8b\u52a1\u7ba1\u7406\u5df2\u914d\u7f6e\u3001\u8c03\u7528\u7ecf\u8fc7\u4e8b\u52a1\u62e6\u622a&#xff0c;\u5e76\u4e14\u5e95\u5c42\u64cd\u4f5c\u5b9e\u9645\u53c2\u4e0e\u540c\u4e00\u4e2a\u4e8b\u52a1\u3002<\/p>\n<p>\u672c\u6587\u8ba8\u8bba\u7684\u662f Spring \u7684 org.springframework.transaction.annotation.Transactional&#xff0c;\u4ee5\u53ca\u9ed8\u8ba4\u7684\u4ee3\u7406\u6a21\u5f0f\u3002\u8fd9\u4e2a\u6a21\u5f0f\u4e0b&#xff0c;\u8c03\u7528\u5fc5\u987b\u7ecf\u8fc7\u4ee3\u7406&#xff1b;\u540c\u4e00\u5bf9\u8c61\u5185\u7684\u81ea\u8c03\u7528\u4e0d\u4f1a\u89e6\u53d1\u88ab\u8c03\u7528\u65b9\u6cd5\u7684\u65b0\u4e8b\u52a1\u62e6\u622a\u3002\u81ea\u8c03\u7528\u4e5f\u4e0d\u610f\u5473\u7740\u65e2\u6709\u4e8b\u52a1\u6d88\u5931&#xff0c;\u8981\u770b\u5916\u5c42\u662f\u5426\u5df2\u7ecf\u5efa\u7acb\u4e8b\u52a1\u3002Spring \u4e8b\u52a1\u6ce8\u89e3\u6587\u6863<\/p>\n<p>\u5e95\u5c42\u8fde\u63a5\u540c\u6837\u91cd\u8981\u3002\u539f\u9879\u76ee\u76f4\u63a5\u901a\u8fc7 DriverManager.getConnection() \u5efa\u7acb\u8fde\u63a5&#xff0c;\u4e0d\u80fd\u6307\u671b\u7ed9\u5916\u5c42\u52a0\u4e2a\u6ce8\u89e3&#xff0c;\u5c31\u628a\u8fd9\u6761\u72ec\u7acb\u8fde\u63a5\u81ea\u52a8\u7eb3\u5165 Spring \u672c\u5730\u4e8b\u52a1\u3002\u4f7f\u7528 JdbcTemplate \u7b49\u4e8b\u52a1\u611f\u77e5\u7684\u6570\u636e\u8bbf\u95ee\u65b9\u5f0f&#xff0c;\u5e76\u5339\u914d\u4e8b\u52a1\u7ba1\u7406\u5668\u53ca\u6570\u636e\u6e90&#xff0c;\u624d\u80fd\u8ba9\u8fde\u63a5\u53c2\u4e0e\u9884\u671f\u7684\u4e8b\u52a1\u3002Spring \u6570\u636e\u5e93\u8fde\u63a5\u7ba1\u7406\u6587\u6863<\/p>\n<p>\u8fd8\u8981\u770b\u5f02\u5e38\u89c4\u5219\u3002\u672a\u989d\u5916\u4fee\u6539\u9ed8\u8ba4\u914d\u7f6e\u65f6&#xff0c;Spring \u9ed8\u8ba4\u5bf9 RuntimeException \u548c Error \u56de\u6eda&#xff0c;\u5bf9\u53d7\u68c0\u5f02\u5e38\u5e76\u4e0d\u9ed8\u8ba4\u56de\u6eda&#xff1b;SQLException \u5c31\u662f\u53d7\u68c0\u5f02\u5e38\u3002rollbackFor &#061; Exception.class \u53ef\u4ee5\u6269\u5c55\u89c4\u5219&#xff0c;\u4f46\u5b83\u4e5f\u4e0d\u80fd\u81ea\u52a8\u8bc6\u522b\u88ab\u4e1a\u52a1\u4ee3\u7801\u541e\u6389\u7684\u5f02\u5e38\u3002Spring \u56de\u6eda\u89c4\u5219\u6587\u6863<\/p>\n<p>\u5982\u679c\u4ee3\u7801\u6355\u83b7\u5f02\u5e38\u540e\u53ea\u8fd4\u56de\u5931\u8d25\u6807\u5fd7&#xff0c;\u4e8b\u52a1\u62e6\u622a\u5668\u53ef\u80fd\u770b\u5230\u7684\u662f\u4e00\u6b21\u6b63\u5e38\u8fd4\u56de\u3002\u662f\u5426\u56de\u6eda&#xff0c;\u8fd8\u8981\u770b\u6709\u6ca1\u6709\u5176\u4ed6\u673a\u5236\u5c06\u4e8b\u52a1\u6807\u8bb0\u4e3a\u4ec5\u56de\u6eda\u3002<\/p>\n<h3>\u516d\u3001\u6e90\u7801\u91cc\u8fd8\u6709\u4e00\u4e2a\u503c\u5f97\u7559\u610f\u7684\u5f02\u5e38\u5206\u652f<\/h3>\n<p>\u56de\u5230\u6700\u5f00\u59cb\u7684 insertChunks()&#xff0c;\u5b83\u6355\u83b7\u7684\u662f SQLException\u3002\u4f46\u5faa\u73af\u4e2d\u7684 embeddingToJson() \u5728\u5e8f\u5217\u5316\u5931\u8d25\u65f6&#xff0c;\u4f1a\u629b\u51fa RuntimeException\u3002<\/p>\n<p>\u8fd9\u6761\u5f02\u5e38\u8def\u5f84\u4e0d\u4f1a\u8fdb\u5165 catch (SQLException e)&#xff0c;\u5374\u4ecd\u7136\u4f1a\u8fdb\u5165 finally\u3002\u6240\u4ee5&#xff0c;\u8fd9\u4e2a\u8282\u9009\u4e0d\u9002\u5408\u4e0d\u52a0\u8bf4\u660e\u5730\u5f53\u6210\u201c\u8986\u76d6\u6240\u6709\u5931\u8d25\u7684\u901a\u7528\u4e8b\u52a1\u6a21\u677f\u201d\u3002\u5177\u4f53\u540e\u679c\u53d6\u51b3\u4e8e\u5f02\u5e38\u53d1\u751f\u65f6\u662f\u5426\u5df2\u6709\u6570\u636e\u5e93\u4fee\u6539\u7b49\u6761\u4ef6&#xff0c;\u4e0d\u80fd\u76f4\u63a5\u65ad\u8a00\u4e00\u5b9a\u51fa\u73b0\u90e8\u5206\u63d0\u4ea4\u3002<\/p>\n<p>\u5b9e\u9645\u5b9e\u73b0\u81f3\u5c11\u9700\u8981\u8003\u8651 SQL \u5f02\u5e38\u3001\u8fd0\u884c\u65f6\u5f02\u5e38&#xff0c;\u4ee5\u53ca\u56de\u6eda\u6216\u6e05\u7406\u518d\u6b21\u5931\u8d25\u65f6\u5982\u4f55\u4fdd\u7559\u6700\u521d\u7684\u9519\u8bef\u3002\u6838\u5fc3\u8981\u6c42\u662f&#xff1a;\u63d0\u4ea4\u524d\u7684\u5931\u8d25\u5e94\u6cbf\u9884\u671f\u8def\u5f84\u89e6\u53d1\u56de\u6eda&#xff0c;\u8fde\u63a5\u72b6\u6001\u6062\u590d\u5e94\u5efa\u7acb\u5728\u4e8b\u52a1\u72b6\u6001\u5df2\u59a5\u5584\u5904\u7406\u7684\u57fa\u7840\u4e0a\u3002<\/p>\n<p>\u8fd9\u91cc\u4e5f\u6ca1\u6709\u8bc1\u636e\u8bf4\u660e\u539f\u4f5c\u8005\u6545\u610f\u9009\u62e9\u4e86\u5f53\u524d\u5931\u8d25\u8fb9\u754c\u3002\u5355\u6587\u4ef6\u89e3\u6790\u5931\u8d25\u540e\u7ee7\u7eed\u6536\u96c6\u6570\u636e&#xff0c;\u4e0e\u6301\u4e45\u5316\u9636\u6bb5\u662f\u5426\u6574\u4f53\u539f\u5b50&#xff0c;\u662f\u4e24\u4e2a\u72ec\u7acb\u8bbe\u8ba1\u95ee\u9898&#xff0c;\u4e0d\u80fd\u7528\u524d\u8005\u66ff\u540e\u8005\u89e3\u91ca\u52a8\u673a\u3002<\/p>\n<h3>\u4e03\u3001\u4e8b\u52a1\u8fb9\u754c\u5e94\u8be5\u5305\u4f4f\u54ea\u4e00\u6bb5&#xff1f;<\/h3>\n<p>\u8fd9\u4e2a\u7d22\u5f15\u6d41\u7a0b\u5148\u8bfb\u53d6\u6587\u4ef6\u3001\u751f\u6210 Embedding\u3001\u6536\u96c6\u5173\u7cfb&#xff0c;\u518d\u8fdb\u5165\u6570\u636e\u5e93\u5199\u5165\u9636\u6bb5\u3002\u5982\u679c\u76ee\u6807\u662f\u907f\u514d\u6301\u4e45\u5316\u5931\u8d25\u7834\u574f\u65e7\u6570\u636e&#xff0c;\u53ef\u4ee5\u4f18\u5148\u8003\u8651\u628a\u201c\u5220\u9664\u65e7\u8bb0\u5f55 &#043; \u5199\u5165\u4e24\u5f20\u8868\u201d\u653e\u8fdb\u4e00\u4e2a\u77ed\u4e8b\u52a1\u3002<\/p>\n<p>\u901a\u5e38\u4e0d\u5fc5\u4e3a\u4e86\u8fd9\u4e2a\u76ee\u6807&#xff0c;\u628a\u8017\u65f6\u7684\u6587\u4ef6\u626b\u63cf\u548c\u8fdc\u7a0b Embedding \u8bf7\u6c42\u4e5f\u653e\u8fdb\u53bb\u3002\u6570\u636e\u5e93\u4e8b\u52a1\u4e5f\u4e0d\u80fd\u64a4\u9500\u5df2\u7ecf\u53d1\u751f\u7684\u8fdc\u7a0b\u8c03\u7528\u3002<\/p>\n<p>\u5982\u679c\u6570\u636e\u91cf\u66f4\u5927\u3001\u9700\u8981\u66f4\u957f\u65f6\u95f4\u6784\u5efa&#xff0c;\u53ef\u4ee5\u8fdb\u4e00\u6b65\u7814\u7a76\u7248\u672c\u5316\u7d22\u5f15&#xff1a;\u5148\u51c6\u5907\u65b0\u7248\u672c\u7684\u6570\u636e&#xff0c;\u6210\u529f\u540e\u518d\u5207\u6362\u5f53\u524d\u7248\u672c\u6807\u8bc6\u3002\u8fd9\u662f\u53e6\u4e00\u79cd\u8bbe\u8ba1\u65b9\u5411&#xff0c;\u4e0d\u662f\u672c\u6587\u5df2\u7ecf\u5b8c\u6210\u7684\u6539\u9020\u3002<\/p>\n<p>\u56de\u987e\u8fd9\u6b21\u9605\u8bfb&#xff0c;\u6211\u66f4\u613f\u610f\u5148\u95ee\u56db\u4e2a\u95ee\u9898&#xff0c;\u518d\u5224\u65ad\u201c\u4e8b\u52a1\u6709\u6ca1\u6709\u751f\u6548\u201d&#xff1a;<\/p>\n<li>\u8c01\u8d1f\u8d23\u63d0\u4ea4\u548c\u56de\u6eda&#xff1f;<\/li>\n<li>\u5404\u4e2a\u64cd\u4f5c\u4f7f\u7528\u7684\u8fde\u63a5\u662f\u5426\u5c5e\u4e8e\u540c\u4e00\u4e2a\u4e8b\u52a1&#xff1f;<\/li>\n<li>\u4e2d\u9014\u662f\u5426\u5df2\u7ecf\u63d0\u4ea4\u8fc7&#xff1f;<\/li>\n<li>\u5f02\u5e38\u80fd\u5426\u62b5\u8fbe\u8d1f\u8d23\u56de\u6eda\u7684\u90a3\u4e00\u5c42&#xff1f;<\/li>\n<p>\u4e8b\u52a1\u6ce8\u89e3\u662f\u5165\u53e3&#xff0c;\u4e1a\u52a1\u64cd\u4f5c\u4e4b\u95f4\u7684\u63d0\u4ea4\u8fb9\u754c\u624d\u51b3\u5b9a\u5931\u8d25\u540e\u80fd\u6062\u590d\u5230\u54ea\u91cc\u3002<\/p>\n<p>\u4f60\u9047\u5230\u8fc7\u54ea\u4e9b\u201c\u65b9\u6cd5\u660e\u660e\u6709\u4e8b\u52a1&#xff0c;\u6574\u4e2a\u6d41\u7a0b\u5374\u6ca1\u6709\u4e00\u8d77\u56de\u6eda\u201d\u7684\u60c5\u51b5&#xff1f;\u6b22\u8fce\u5e26\u4e0a\u8c03\u7528\u987a\u5e8f\u548c\u5f02\u5e38\u5904\u7406\u65b9\u5f0f\u4e00\u8d77\u8ba8\u8bba\u3002<\/p>\n<hr \/>\n<p>\u26f5 \u6211\u662f \u5c0f\u5c0f\u653e\u821f&#xff0c;\u8bb0\u5f55 Java \u540e\u7aef\u4e0e AI Agent \u7684\u5b66\u4e60\u3001\u5b9e\u8df5\u548c\u8e29\u5751\u8fc7\u7a0b\u3002<\/p>\n<p>\u5982\u679c\u8fd9\u7bc7\u6587\u7ae0\u5bf9\u4f60\u6709\u5e2e\u52a9&#xff0c;\u6b22\u8fce\u6536\u85cf&#xff0c;\u4e0b\u6b21\u6392\u67e5\u4e8b\u52a1\u95ee\u9898\u65f6\u5bf9\u7167\u68c0\u67e5\u3002<\/p>\n<p>\u5c0f\u5c0f\u653e\u821f\u7684 CSDN<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6ca1\u5199 Transactional&#xff0c;\u4e8b\u52a1\u5c31\u4e0d\u751f\u6548&#xff1f;\u4ece\u4e00\u6b21\u7d22\u5f15\u91cd\u5efa\u770b\u61c2\u4e8b\u52a1\u8fb9\u754c<br \/>\n\u65b9\u6cd5\u91cc\u6709\u63d0\u4ea4\u548c\u56de\u6eda&#xff0c;\u4e0d\u4ee3\u8868\u6574\u4e2a\u4e1a\u52a1\u6d41\u7a0b\u90fd\u80fd\u4e00\u8d77\u56de\u6eda\u3002\u5224\u65ad\u4e8b\u52a1\u662f\u5426\u6709\u6548&#xff0c;\u9700\u8981\u6cbf\u8c03\u7528\u94fe\u627e\u5230\u771f\u6b63\u7684\u63d0\u4ea4\u8fb9\u754c\u3002 \u672c\u6587\u4ece\u77e5\u8bc6\u5e93\u4e2d\u7684 PaiCLI \u9605\u8bfb\u7b14\u8bb0\u51fa\u53d1&#xff0c;\u91cd\u65b0\u6838\u5bf9\u4e86\u5f53\u524d\u672c\u5730\u6e90\u7801\u3002\u9879\u76ee\u4f7f\u7528 Java 17\u3001SQLite JDBC&#xff0c;\u672a\u4f7f\u7528 Spring&#xff1b;Spring \u90e8\u5206\u7528\u4e8e\u673a\u5236\u5bf9\u7167\u3002\u6587\u4e2d\u7684\u5931\u8d25\u7ed3\u679c\u662f\u57fa\u4e8e\u4ee3\u7801\u7684<\/p>\n","protected":false},"author":2,"featured_media":121969,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[74,99,426,1271,292],"topic":[],"class_list":["post-121970","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-agent","tag-java","tag-jvm","tag-springboot","tag-292"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u6ca1\u5199 @Transactional\uff0c\u4e8b\u52a1\u5c31\u4e0d\u751f\u6548\uff1f\u4ece\u4e00\u6b21\u7d22\u5f15\u91cd\u5efa\u770b\u61c2\u4e8b\u52a1\u8fb9\u754c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/121970.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u6ca1\u5199 @Transactional\uff0c\u4e8b\u52a1\u5c31\u4e0d\u751f\u6548\uff1f\u4ece\u4e00\u6b21\u7d22\u5f15\u91cd\u5efa\u770b\u61c2\u4e8b\u52a1\u8fb9\u754c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6ca1\u5199 Transactional&#xff0c;\u4e8b\u52a1\u5c31\u4e0d\u751f\u6548&#xff1f;\u4ece\u4e00\u6b21\u7d22\u5f15\u91cd\u5efa\u770b\u61c2\u4e8b\u52a1\u8fb9\u754c \u65b9\u6cd5\u91cc\u6709\u63d0\u4ea4\u548c\u56de\u6eda&#xff0c;\u4e0d\u4ee3\u8868\u6574\u4e2a\u4e1a\u52a1\u6d41\u7a0b\u90fd\u80fd\u4e00\u8d77\u56de\u6eda\u3002\u5224\u65ad\u4e8b\u52a1\u662f\u5426\u6709\u6548&#xff0c;\u9700\u8981\u6cbf\u8c03\u7528\u94fe\u627e\u5230\u771f\u6b63\u7684\u63d0\u4ea4\u8fb9\u754c\u3002 \u672c\u6587\u4ece\u77e5\u8bc6\u5e93\u4e2d\u7684 PaiCLI \u9605\u8bfb\u7b14\u8bb0\u51fa\u53d1&#xff0c;\u91cd\u65b0\u6838\u5bf9\u4e86\u5f53\u524d\u672c\u5730\u6e90\u7801\u3002\u9879\u76ee\u4f7f\u7528 Java 17\u3001SQLite JDBC&#xff0c;\u672a\u4f7f\u7528 Spring&#xff1b;Spring \u90e8\u5206\u7528\u4e8e\u673a\u5236\u5bf9\u7167\u3002\u6587\u4e2d\u7684\u5931\u8d25\u7ed3\u679c\u662f\u57fa\u4e8e\u4ee3\u7801\u7684\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/121970.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-11-03T19:48:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261103194847-6aea3a9ff1a93.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/121970.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/121970.html\",\"name\":\"\u6ca1\u5199 @Transactional\uff0c\u4e8b\u52a1\u5c31\u4e0d\u751f\u6548\uff1f\u4ece\u4e00\u6b21\u7d22\u5f15\u91cd\u5efa\u770b\u61c2\u4e8b\u52a1\u8fb9\u754c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-11-03T19:48:50+00:00\",\"dateModified\":\"2026-11-03T19:48:50+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/121970.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/121970.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/121970.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u6ca1\u5199 @Transactional\uff0c\u4e8b\u52a1\u5c31\u4e0d\u751f\u6548\uff1f\u4ece\u4e00\u6b21\u7d22\u5f15\u91cd\u5efa\u770b\u61c2\u4e8b\u52a1\u8fb9\u754c\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u6ca1\u5199 @Transactional\uff0c\u4e8b\u52a1\u5c31\u4e0d\u751f\u6548\uff1f\u4ece\u4e00\u6b21\u7d22\u5f15\u91cd\u5efa\u770b\u61c2\u4e8b\u52a1\u8fb9\u754c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/121970.html","og_locale":"zh_CN","og_type":"article","og_title":"\u6ca1\u5199 @Transactional\uff0c\u4e8b\u52a1\u5c31\u4e0d\u751f\u6548\uff1f\u4ece\u4e00\u6b21\u7d22\u5f15\u91cd\u5efa\u770b\u61c2\u4e8b\u52a1\u8fb9\u754c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6ca1\u5199 Transactional&#xff0c;\u4e8b\u52a1\u5c31\u4e0d\u751f\u6548&#xff1f;\u4ece\u4e00\u6b21\u7d22\u5f15\u91cd\u5efa\u770b\u61c2\u4e8b\u52a1\u8fb9\u754c \u65b9\u6cd5\u91cc\u6709\u63d0\u4ea4\u548c\u56de\u6eda&#xff0c;\u4e0d\u4ee3\u8868\u6574\u4e2a\u4e1a\u52a1\u6d41\u7a0b\u90fd\u80fd\u4e00\u8d77\u56de\u6eda\u3002\u5224\u65ad\u4e8b\u52a1\u662f\u5426\u6709\u6548&#xff0c;\u9700\u8981\u6cbf\u8c03\u7528\u94fe\u627e\u5230\u771f\u6b63\u7684\u63d0\u4ea4\u8fb9\u754c\u3002 \u672c\u6587\u4ece\u77e5\u8bc6\u5e93\u4e2d\u7684 PaiCLI \u9605\u8bfb\u7b14\u8bb0\u51fa\u53d1&#xff0c;\u91cd\u65b0\u6838\u5bf9\u4e86\u5f53\u524d\u672c\u5730\u6e90\u7801\u3002\u9879\u76ee\u4f7f\u7528 Java 17\u3001SQLite JDBC&#xff0c;\u672a\u4f7f\u7528 Spring&#xff1b;Spring \u90e8\u5206\u7528\u4e8e\u673a\u5236\u5bf9\u7167\u3002\u6587\u4e2d\u7684\u5931\u8d25\u7ed3\u679c\u662f\u57fa\u4e8e\u4ee3\u7801\u7684","og_url":"https:\/\/www.wsisp.com\/helps\/121970.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-11-03T19:48:50+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261103194847-6aea3a9ff1a93.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/121970.html","url":"https:\/\/www.wsisp.com\/helps\/121970.html","name":"\u6ca1\u5199 @Transactional\uff0c\u4e8b\u52a1\u5c31\u4e0d\u751f\u6548\uff1f\u4ece\u4e00\u6b21\u7d22\u5f15\u91cd\u5efa\u770b\u61c2\u4e8b\u52a1\u8fb9\u754c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-11-03T19:48:50+00:00","dateModified":"2026-11-03T19:48:50+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/121970.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/121970.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/121970.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u6ca1\u5199 @Transactional\uff0c\u4e8b\u52a1\u5c31\u4e0d\u751f\u6548\uff1f\u4ece\u4e00\u6b21\u7d22\u5f15\u91cd\u5efa\u770b\u61c2\u4e8b\u52a1\u8fb9\u754c"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/121970","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=121970"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/121970\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/121969"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=121970"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=121970"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=121970"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=121970"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}