Posts

Showing posts with the label One-to-Many

Spring Boot, MyBatis One-to-Many and One-to-One Selects - XML Mapping Example

Image
In this section, we will learn how to handle One-to-Many and One-to-One selects in Spring Boot, MyBatis application (XML Mapping 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-xml-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-xml-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" ?>

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