Wednesday 15 January 2014

java - Customizable timeout on MyBatis -


Is there any way to create customizable time for Mybitis configuration?

I am experimenting with Mybitalis Spring as a framework, but I can not make the 'DefaultStatementTimeout' property customizable, as on Property PropertyHolder

One way, but only through the MyBatis configuration file that you want to load You can add the location of the MyBatis configuration file to your Spring Configuration file (in the MyBatis page):

  & lt; Bean id = "sqlSessionFactory" class = "org.mybatis.spring.SqlSessionFactoryBean" & gt; & Lt; Property Name = "Data Source" Riff = "Data Sources" / & gt; & Lt; Property Name = "Location" value = "Class Text: mybatis-config.xml" /> & Lt; / Bean & gt;   

The MyBatis configuration file can be:

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt ;! DOCTYPE PUBLIC CONFIGURATION "- // mybatis.org//DTD Config 3.0 // n" "http://mybatis.org/dtd/mybatis-3-config.dtd"> & Lt; Configuration & gt; & Lt; Settings & gt; & Lt; Setting name = "Default default timeout" value = "10" /> & Lt ;! - sec - & gt; & Lt; / Settings & gt; & Lt; / Configuration & gt;    

No comments:

Post a Comment