Skip to content

Latest commit

 

History

History
43 lines (29 loc) · 1.78 KB

File metadata and controls

43 lines (29 loc) · 1.78 KB

Spring Boot JPA Query Execution

This repository contains a Spring Boot project that demonstrates executing database queries using Spring Data JPA. The project focuses on retrieving and managing employee data using derived query methods, JPQL (HQL), and native SQL queries.

Technologies Used

  • Java
  • Spring Boot
  • Spring Data JPA
  • Hibernate
  • REST API
  • MySQL / Relational Database

Project Structure

Employee Controller

The EmployeeController class contains REST APIs used to perform operations related to employees. These APIs handle client requests and return responses using Spring Boot REST architecture.

Employee Entity

The Employee class is an entity class that represents the Employee table in the database.It includes Private variables, Getter and Setter methods , JPA annotations for object relational mapping

Employee Repository

The EmployeeRepository interface extends JpaRepository, which provides built-in CRUD operations. Additional query methods are defined in the repository to perform custom database operations.

Query Execution Methods

Derived Query Methods

Queries created using predefined keywords provided by Spring Data JPA such as:

  • findByName()
  • findByDepartment()
  • findBySalaryGreaterThan()

Spring Data JPA automatically generates the query based on the method name.

JPQL / HQL Queries

JPQL (Java Persistence Query Language) is used to perform custom queries based on entity objects rather than database tables.

Native SQL Queries

Native SQL queries allow direct interaction with the database using SQL syntax and are useful for complex queries.

Purpose of the Project

The purpose of this project is to understand how Spring Boot interacts with databases using JPA and how different query execution methods are implemented in backend development.