Posts

Showing posts with the label Annotation

Spring Boot, MyBatis One-to-Many and One-to-One Selects - Annotations Example

Image
In this section, we will learn how to handle One-to-Many and One-to-One selects in Spring Boot, MyBatis application (Annotations example). Technologies used: Spring Boot 3.0.2 MyBatis 3 Java 17 Maven  H2 Database Creating a simple spring boot web application: First, open the Spring initializr  https://start.spring.io/   Then, Provide the Group and Artifact name. We have provided Group name  com.knf.dev.demo  and Artifact  spring-boot-mybatis-one-to-many-one-to-one . Here I selected the  Maven  project - language  Java 17  -  Spring Boot 3.0.2  and add  Spring web dependency ,  MyBatis Framework  and  H2 Database . Then, click on the Generate button. When we click on the Generate button, it starts packing the project in a .zip( spring-boot-mybatis-one-to-many-one-to-one ) file and downloads the project. Then, Extract the Zip file.  Then, import the project on your favourite IDE. Final Project directory: pom.xml <? xml version ="1.0" encoding ="UTF-8" ?> < pr

Build REST CRUD APIs with Kotlin, Spring Boot and MyBatis

Image
Hello everyone, today we will learn how to develop REST-style CRUD APIs with Spring Boot, Kotlin, MyBatis, and H2 Database.  You can download the source code from our Github repository. What is MyBatis? MyBatis is a persistence framework with support for custom SQL, stored procedures and advanced mappings. MyBatis eliminates almost all of the JDBC code and manual setting of parameters and retrieval of results. MyBatis can use simple XML or Annotations for configuration and map primitives, Map interfaces and Java POJOs (Plain Old Java Objects) to database records. Some of the features of  MyBatis : In memory object filtering Fortifies clustering and simultaneous access by other applications without loss of transaction integrity Query Caching - Built-in support Fortifies disconnected operations Support for Remoting. Distributed Objects. Technologies used : Spring Boot 2.5.4 Spring  5.3.9 MyBatis  Kotlin Gradle After completing this tutorial what we will build?   We will build REST API