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

Chapter 4. SQL Mappers Using Annotations

In the previous chapter, we had seen how we can configure mapped statements in XML Mapper files. MyBatis supports configuring mapped statements using annotations also. When using annotation-based Mapper interfaces you don't need to configure SQL queries in XML files. If you want, you can use XML and annotation-based mapped statements together.

In this chapter we will cover the following topics:

  • Mapper interfaces using annotations
  • Mapped statements
    • @Insert, @Update, @Delete, and @SelectStatements
  • Resultmaps
    • Simple resultmaps
    • One-to-one mapping
    • One-to-many mapping
  • Dynamic SQL
    • @SelectProvider
    • @InsertProvider
    • @UpdateProvider
    • @DeleteProvider

Mapper interfaces using annotations

MyBatis provides annotation-based configuration ...

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