Free Sample
+ Collection

Java Persistence with MyBatis 3

Starting
K. Siva Prasad Reddy

Getting started with the MYBatis framework is greatly simplified with this step-by-step guide that’s packed with practical exercises. Now you can quickly and confidently take your Java capabilities into the arena of data persistence.
$14.99
$29.99
RRP $14.99
RRP $29.99
eBook
Print + eBook

Want this title & more?

$21.99 p/month

Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Book Details

ISBN 139781782166801
Paperback132 pages

About This Book

Detailed instructions on how to use MyBatis with XML and Annotation-based SQL MappersAn in-depth discussion on how to map complex SQL query results such as One-To-Many and Many-To-Many using MyBatis ResultMapsStep-by-step instructions on how to integrate MyBatis with a Spring framework

Who This Book Is For

This book is for Java developers who would like to learn all about the MyBatis framework and are looking for a practical guide to get started. The prerequisites required for this book are basic Java and SQL skills. No prior knowledge of MyBatis is expected.

Table of Contents

Chapter 1: Getting Started with MyBatis
What is MyBatis?
Why MyBatis?
Installing and configuring MyBatis
Sample domain model
Summary
Chapter 2: Bootstrapping MyBatis
Configuring MyBatis using XML
Configuring MyBatis using Java API
Customizing MyBatis logging
Summary
Chapter 3: SQL Mappers Using XML
Mapper XMLs and Mapper interfaces
Mapped statements
ResultMaps
Dynamic SQL
MyBatis recipes
Summary
Chapter 4: SQL Mappers Using Annotations
Mapper interfaces using annotations
Mapped statements
Result maps
Dynamic SQL
Summary
Chapter 5: Integration with Spring
Configuring MyBatis in a Spring application
Working with SqlSession
Working with mappers
Transaction management using Spring
Summary

What You Will Learn

Simplify database persistence layer implementationInstall and configure MyBatis using XML and Java APIMap One-To-Many and Many-To-Many results using XML and Annotated MappersUse TypeAliases and Custom Type HandlersHandle pagination and custom SQL ResultSet processingBuild Dynamic Queries using XML and SqlProvider annotationsUse Spring’s Annotation-based Transaction Handling with MyBatis

In Detail

Storing and retrieving data to and from relational databases is a very common requirement, and is a crucial part of many applications. Even though Java provides a JDBC API for database access, it is not very effective and involves writing the boilerplate code again and again. Getting data out of a database, populating into Java objects, and persisting data from Java objects into a database using JDBC involves a lot of repetitive coding and is a very tedious process. MyBatis takes the simplest approach of leveraging the existing knowledge and power of Java and SQL yet provides powerful features to make data persistence implementation easy. Java Persistence with MyBatis 3 is a practical, hands-on guide that provides you with a number of clear step-by-step exercises, which will help you to understand how MyBatis works and how to use it for your real application needs. With MyBatis, you will learn how to use the MyBatis framework effectively through simple instructions. Java Persistence with MyBatis 3 will highlight the cumbersome process of data persistence using plain JDBC and will also show you how easy it is to implement the same using MyBatis. You will also take a deeper look into the implementation of MyBatis with XML and Annotation-based Mappers, and finally learn how to integrate MyBatis with a Spring framework. You will learn how to map Complex SQL query results to Java beans using XML and Annotation-based Mappers, including One-To-Many and Many-To-Many relationships. You will also learn how to use TypeAliases and Custom Type Handlers, and build dynamic queries using XML and SqlProvider annotations. It progresses to detailed instructions on integrating MyBatis with Spring and leveraging Spring’s Annotation-based transaction handling mechanism, which further simplifies the usage of MyBatis.With Java Persistence with MyBatis 3, you will learn how to use the MyBatis framework effectively through simple instructions.

Authors

Read More