sqlmap namespace ibatis 沒有生效

來源:互聯網
上載者:User

ibatis的設定檔中有一個命名空間的屬性,如<sqlMap namespace="common">,預設情況下這個功能是關閉的。
要開啟它需要在SqlMapConfig.xml檔案中進行配置:

<!DOCTYPE sqlMapConfig PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN""http://ibatis.apache.org/dtd/sql-map-config-2.dtd"><sqlMapConfig><settings                 useStatementNamespaces="true" /><sqlMap resource="com/taobao/jingwei/webconsole/biz/dao/model/JwUser.xml" /><sqlMap resource="com/taobao/jingwei/webconsole/biz/dao/model/JwPermission.xml" /><sqlMap resource="com/taobao/jingwei/webconsole/biz/dao/model/JwResource.xml" /></sqlMapConfig>

參考 http://java123.blog.51cto.com/397472/90438

useStatementNamespaces  
是否使用Statement命名空間。 
這裡的命名空間指的是對應檔中,sqlMap節的namespace屬性,如在上例中針對t_use
表的對應檔sqlMap節點: <sqlMap namespace="User"> 這裡,指定了此sqlMap節點下定義的操作均屬於"User"命名空間。 在useStatementNamespaces="true"的情況下,Statement調用需追加命名空間,如:sqlMap.update("User.updateUser",user); 
否則直接通過Statement名稱調用即可,如: sqlMap.update("updateUser",user); 但請注意此時需要保證所有對應檔中,Statement定義無重名。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.