Ibatis SqlMapConfig.xml Settings 详解


  cacheModelsEnabled="true"  //启用SqlMapClient上的缓存机制

      classInfoCacheEnabled="true"//保存缓存类,减少类的重用

      statementCachingEnabled="true"  //iBATIS 2.3.0以后版本中有 ,启动预处理缓存机制

      enhancementEnabled="true"  //针对POJO启用字节码增强机getter/setter的调用效能

      lazyLoadingEnabled="true" //启用延迟加载机制

      useStatementNamespaces="true" //使用Statement命名空间

      errorTracingEnabled="true"> //启用错误日志,方便开发阶段调试

       maxRequests ="256"    //最大并发请求数(Statement并发数)
        maxSessions ="10"  //最大Session数。即当前最大允许的并发SqlMapClient数 
       maxTransactions ="5"  //最大并发事务数

classInfoCacheEnabled="true"  当有很多类被ibatis重复使用的时候,会减少创建时间,提高效率
forceMultipleResultSetSupport是否启用多结果集支持,就是多个resultset
errorTracingEnabled是否启用错误日志
defaultStatementTimeout数据库操作的超时时间,并不是连接超时时间,而是statement的执行超时时间
statementCachingEnabled缓存statement,应该是当你再次调用同样的statement语句的时候(比如再次执行同样的查询),将不会重新创建,而是从缓存里读取

以上设置直接采用默认即可,设置上true,基本上都是对ibatis的优化





sqlMapConfig PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-config-2.dtd">

<sqlMapConfig>
    maxRequests="32"
  maxSessions="10"
  maxTransactions="5"
  useStatementNamespaces="true"
 />
 
sqlMapConfig>







    cacheModelsEnabled="true"
    lazyLoadingEnabled="false"
    enhancementEnabled="true"
    maxSessions="64"
    maxTransactions="8"
    maxRequests="128"
    useStatementNamespaces="false"
    classInfoCacheEnabled="true"
    errorTracingEnabled="true"
    defaultStatementTimeout=""
    statementCachingEnabled="true"
    />



你可能感兴趣的:(Ibatis SqlMapConfig.xml Settings 详解)