Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

CHAPTER 11: Using MyBatis in Spring > Database Operations with MyBatis

Database Operations with MyBatis

In this section, we discuss how to perform various CRUD operations with MyBatis in Spring.

For querying data, we will discuss how to perform mappings from SQL to POJOs, as well as model the relationships between domain objects. Moreover, topics including named parameters and dynamic SQL support in MyBatis will also be covered.

Finally, we will also discuss how to use MyBatis to implement insert/update/delete operations.

Querying Data

MyBatis provides intensive support for querying data in a database. Basically, for each select operation, we will define the SQL statement, the parameters, the result type (Java type), and the result mapping to use. Various relationships (one-to-one, one-to-many, and many-to-many) can be mapped easily. Another powerful feature in MyBatis is the support of dynamic SQL, which we will discuss in the following sections.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial