Spring

@RequestParam and @PathVariable in Spring Boot REST

@RequestParam and @PathVariable in Spring Boot REST | We will discuss how to pass request parameters to the rest APIs. To pass request parameters @RequestParam and @PathVariable are used in Spring. First, let us see @RequestParam. @RequestParam in Spring Boot REST Request Parameter format: URL?key=val&key=val&key=val…. It even supports type conversion, (String -> int) based on […]

@RequestParam and @PathVariable in Spring Boot REST Read More »

@Transactional in Spring Data JPA

@Transactional in Spring Data JPA | Transactions is a database concept (not specific to Spring Boot). It has two operations:- When Transactions are required? For Every non-select operation transactions are required. Transactions are not required for select operations. Here we have two functions / operations / commands:- Buffers are part of RAM only. MySQL Queries:-

@Transactional in Spring Data JPA Read More »

Findby Method in Spring Data JPA

Findby Method in Spring Data JPA | findBy is an abstract method that derives a query at runtime based on details in the method name. What is the difference between findBy and @Query? @Query works for SQL databases only but supports both SELECT and non-SELECT operations. In @Query custom/manual query must be given and it

Findby Method in Spring Data JPA Read More »

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 »