Java 17
Maven 4.0.0
MySql Ver 8.0.32
Spring Boot 3.0.5
IntelliJ IDEA 2023.1 (Community Edition)
- It consists of Employee and Address entity classes along with their data members and member functions
- Used @Table and @Entity annotations inside the entity class.
- Used Lombok to reduce boilerplate code for pojo class.By using Lombok annotations like @Data, @NoArgsConstructor, @AllArgsConstructor getters and setters for those object generate automatically.
- Used @OneToOne annotation to perform one to one mapping between Employee and Address.
- It consists of EmployeeController and AddressController classes in which used the annotations like @RestController to annotate the class as Controller.
- Used annotation @GetMapping , @PostMapping , @PutMapping , @DeleteMapping to map the HTTP web requests to the specific handler methods.
Employee's API References
- Add Employee:
http://localhost:8080/employee/
- Get all Employees:
http://localhost:8080/employee/getAll
- Get Employee By ID:
http://localhost:8080/employee/{employeeId}
- Update Employee by Employee ID
http://localhost:8080/employee/{employeeId}/firstName/{firstName}/lastName/{lastName}
- Delete Employee by ID
http://localhost:8080/employee/{employeeId}
Address's API References:
- Add Address:
http://localhost:8080/address/
- Get all Addresses:
http://localhost:8080/address/getAll
- Get Address By ID:
http://localhost:8080/address/{addressId}
- Update Address's Street by Address ID
http://localhost:8080/address/{addressId}/{street}
- Delete Address by ID
http://localhost:8080/address/{addressId}
- It consists of EmployeeService and AddressService classes in which provide some business functionalities of every handler methods.
- Used @Service annotation to indicate that a class belongs to the service layer.
- Used @Transactional annotation to separate transaction management code from the code for business logic on the update and delete methods.
- It consists of IEmployeeDao and IAddressDao interface classes that extends CrudRepository which is interface for generic inbuilt CRUD operations on a repository for a specific type. Usually represent the database access layer in an application.
- Used Iterable for Employee and Address to manage the data of Employee and Address by performing CRUD operations.
- Used @Repository annotation is used to indicate that the class provides the mechanism for storage, retrieval, search, update and delete operation on objects.
- Used @Modifying annotation wrote named parameters query using @Query annotation to insert, update, or delete an entity.
Used Iterable<T>
for Employee and Address to store the User type object.
- In this project I performed CRUD operation like add user,get user,delete user and update user.
- The aim of this project to perform one to one mapping between Employee and Address.
- Used interface CrudRepository class for generic CRUD inbuilt operations like save,saveAll,updateById, etc.
- Used our own custom finder methods and wrote operations using custom queries.