Spring

Association Mapping in Spring Data JPA

Association Mapping in Spring Data JPA | We will discuss one-to-one, one-to-many, many-to-one, and many-to-many association mappings through examples. Multiplicity: Connecting multiple tables using primary-key & foreign-key concepts. One table’s primary key is taken as another table’s foreign key. There are 4 types of Multiplicity:- All these are used best on requirement but one-to-many and […]

Association Mapping in Spring Data JPA Read More »

HQL/JPQL in Spring Data JPA

HQL/JPQL in Spring Data JPA | Repository interfaces have provided pre-defined methods to do database operations like findAll(), save(), deleteById(), etc. We can also define our query using the concept of “Custom Query”. This can be implemented using:- Here we will see defining custom query using @Query. Also see:- Custom query method (findBy). The HQL/JPQL

HQL/JPQL in Spring Data JPA Read More »

JpaRepository in Spring Data JPA

JpaRepository in Spring Data JPA | JpaRepository internally extends PaginingAndSortingRpository and CrudRepository. Therefore, CRUD operations and PageAndSort are also available in JpaRepository. It also has JPA concepts like Date and Time, Lobs(BLOB, CLOB), Collection Mapping, ASSOCIATION MAPPING, JOINS, COMPONENT MAPPING, etc. In JpaRepository we can define custom queries using one of the following approaches:- In

JpaRepository in Spring Data JPA Read More »

Search Specification | Criteria API in Spring Boot

Search Specification | Criteria API in Spring Boot | Criteria API helps us to create dynamic queries. Let us start with the project setup. Dependencies:- Spring Web, Lombok, MySQL Driver, Spring Data JPAapplication.properties:- Entity Classes:- Repository:- Controller:- After running the application, it will create the tables. Before moving ahead, let us first initialize some data.

Search Specification | Criteria API in Spring Boot Read More »

Spring Data JPA Introduction

Spring Data JPA Introduction | First let us see the difference between JDBC, JPA, Hibernate, and Spring Data JPA. Spring Data JPA:- Annotation:- Example of Using H2 Database Use the spring starter to create the project and add the following dependencies:- Spring Data JPA, Lombok, Spring Web, and H2 database. To work with the H2

Spring Data JPA Introduction Read More »

Scheduling in Spring Boot

Scheduling in Spring Boot | Executing a task in a loop (multiple times), based on a period (or) point of time is called scheduling. Period of time: Time gapEx: 5 minutes, 6 hours, 3 days, 2 months, etc. Point of time: Exact Date and TimeEx: Mar 31st 9 AM, 12th JAN 6 PM, etc. Use

Scheduling in Spring Boot Read More »

Spring Boot Profiles

Spring Boot Profiles | Writing and Loading Properties File based on Environment, is called as Profiles. Profiles are used to load property files based on the environment. Define one properties file for one Environment. Environment:- A system/place where we can deploy and use our application. Dev Env, QA Env, UAT Env, Production Env,..etc. From one

Spring Boot Profiles Read More »