Mybatis settings and mybatis settings

Source: Internet
Author: User

Mybatis settings and mybatis settings

MyBatis settings

Study Notes:

The configuration information of Mybatis can be configured or not typed. After the setting configuration of Mybatis is configured, its runtime behavior will be affected. The following are the keywords of related settings and their meanings:

AggressiveLazyLoding: when it is enabled (true is also the default value), the call to any delayed attribute will complete the loading of objects with the delayed loading attribute.

If it is not enabled (false), each attribute is loaded as needed.

AutoMappingBehavior: Specifies how Mybatis is automatically mapped to a field or attribute. It contains three values:

NONE: Cancel automatic ing.

PARTIAL (default value): Only the result set that does not define the nested result set ing is mapped.

FULL: automatically maps any complex result set.

CallSettersOnNulls: Specifies whether to call the setter (not put when map object is not put) method when the result set value is null. the keySet () dependency or null value is useful during initialization.

The default value is false.

Note: The basic type int and Boolean cannot be set to null.

CacheEnabled: affects global cache switches configured in all mappers. The default value is true.

DefaultExecutorType: configure the default executor.

SIMPLE: SIMPLE Actuator

REUSE: The executor will REUSE the pre-processing statement (prepared, statements)

BATCH: The executor will reuse the statement and execute BATCH update.

DefaultStatementTimeout: sets the supermarket time, which determines the number of seconds for the driver to wait for the database. If no value is set, the default equal second of the driver is used.

The default value is Not Set (null)

DefaultScriptingLanguage: Specifies the default language for dynamic SQL generation. The default value is:

Org. apche. ibatis. SC. ripting. xmltags. xmldynamic.pdf agedriver

You can customize the alias of a class or the full qualified name of a class.

Localcached: Mybatis uses the Local Cache mechanism to prevent circular references and accelerate repeated nested queries.

The default value is that SESSION caches all queries executed in a SESSION.

STATEMENT sessions are only used for STATEMENT execution. Different calls to the same SqlSession will not share data.

JdbcTypeForNull: Specify the jdbc Type for the null value when no specific JDBC Type is provided for the parameter. Some drivers need to specify the JDBC Type of the column. In most cases, the common type can be used directly, such as NULL, VARCHAR, and OTHER (default)

SafeRowBoundsEnabled: Allows pagination (RowBounds) in nested statements ).

The default value is false.

MapUnderscoreToCamelCase: whether to enable camel case ing, that is, similar ing from the classic database column name A_COLUMN to the classic Java attribute aColumn.

The default value is false.

UseGeneratedKeys: Allows JDBC to automatically generate a primary key, which requires driver compatibility. If it is set to true, the auto-generated primary key is forcibly used. Although some drivers are not compatible, they still work properly.

The default value is false.

MultipleResultSetsEnabled: whether to allow a single statement to return multiple result sets (compatible with the driver ).

The default value is true.

 

 

          

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.