日期:2014-05-20  浏览次数:20736 次

求解Attribute "namespace" must be declared for element type "sqlMapConfig"
<?xml version="1.0" encoding="UTF-8" ?>  
<!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  
  cacheModelsEnabled="true"  
  enhancementEnabled="true"  
  lazyLoadingEnabled="true"  
  errorTracingEnabled="true"  
  maxRequests="32"  
  maxSessions="10"  
  maxTransactions="5"  
  useStatementNamespaces="false"  
  />  
  <transactionManager type="JDBC">  
  <dataSource type="SIMPLE">  
  <property name="JDBC.Driver" value="com.mysql.jdbc.Driver"/>  
  <property name="JDBC.ConnectionURL" value="jdbc:mysql://127.0.0.1/mydatabase"/>  
  <property name="JDBC.Username" value="root"/>  
  <property name="JDBC.Password" value="123456"/>  
  <property name="JDBC.DefaultAutoCommit" value="true"/>  
  <property name="Pool.MaximumActiveConnections" value="10"/>  
  <property name="Pool.MaximumIdleConnections" value="5"/>  
  <property name="Pool.MaximumCheckoutTime" value="180000"/>  
  <property name="Pool.TimeToWait" value="10000"/>  
  <property name="Pool.PingQuery" value="select 1 from dual"/>  
  <property name="Pool.PingEnabled" value="true"/>  
  <property name="Pool.PingConnectionsOlderThan" value="0"/>  
  <property name="Pool.PingConnectionsNotUsedFor" value="3600000"/>  
  <property name="Pool.QuietMode" value="true"/>  
  </dataSource>  
  </transactionManager>  
  <sqlMap resource="com/maesinfo/lxl/entity/User.xml"></sqlMap>  
</sqlMapConfig> 
-------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMapConfig 
  PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
  "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
<sqlMapConfig namespace="User">
<typeAlias alias="user" type="com.maesinfo.lxl.entity.User"/>
<select id="getUser" parameterClass="java.lang.String" resultClass="user">
<![CDATA[
select name,sex from t_user where name=#name#
]]>
</select>
<update id="updateUser" parameterClass="user">
<![CDATA[
update t_user set name=#name#,sex=#sex# where id=#id#
]]>
</update>
<insert id="insertUser" parameterClass="user">
<![CDATA[
insert into t_user(name,sex) values(#name#,#sex#) 
]]>
</insert>
<delete id="deleteUser" parameterClass="java.lang.String">
<![CDATA[
delete from t_user where id="#id"