The key component of MyBatis is
SqlSessionFactory from which we get
SqlSession and execute the mapped SQL statements. The
SqlSessionFactory object can be created using XML-based configuration or Java API.
We will explore various MyBatis configuration elements, such as
dataSource, environments, global settings,
typeHandlers, and SQL mappers, and instantiate
In this chapter, we will cover:
The most commonly used approach for building
SqlSessionFactory is XML-based configuration. The following
mybatis-config.xml file shows how a typical MyBatis configuration file looks: ...