O'Reilly logo

Java Persistence with MyBatis 3 by K. Siva Prasad Reddy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Configuring MyBatis using Java API

In the previous section, we have discussed various MyBatis configuration elements, such as environments, typeAliases, and typeHandlers, and how to configure them using XML. Even though you want to use the Java-API-based MyBatis configuration, it would be good to go through the previous section to have a better idea about these configuration elements. In this section, we will be referring to some of the classes described in the previous section.

MyBatis' SqlSessionFactory interface can be created programmatically using the Java API instead of using the XML-based configuration. Each configuration element used in an XML-based configuration can be created programmatically.

We can create the SqlSessionFactory object ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required