Class JpaAssignmentServiceImpl
java.lang.Object
info.ejava_student.starter.assignment5.jpa.assignment.JpaAssignmentServiceImpl
- All Implemented Interfaces:
JpaAssignmentService<HouseRentalDTO,HouseRentalBO>
public class JpaAssignmentServiceImpl
extends Object
implements JpaAssignmentService<HouseRentalDTO,HouseRentalBO>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.data.domain.Slice<HouseRentalBO> findByDateRangeByAnnotatedQuery(LocalDate startDate, LocalDate endDate, org.springframework.data.domain.Pageable pageable) Implement a query that uses @Query annotation on the repository interface method.org.springframework.data.domain.Page<HouseRentalBO> findByExample(HouseRentalBO probe, org.springframework.data.domain.Pageable pageable) Implement a query by example using the probe provided as an input parameter.org.springframework.data.domain.Page<HouseRentalBO> findByHouseIdByDerivedQuery(String houseId, org.springframework.data.domain.Pageable pageable) Implement a derived query using special method keywords to trigger the correct query.mapAndPersist(HouseRentalDTO rentalDTO) Map the DTO to a BO and persist.queryByRentalDateRange(LocalDate startInclusive, LocalDate endInclusive) Implement a JPQL named query.
-
Constructor Details
-
JpaAssignmentServiceImpl
public JpaAssignmentServiceImpl()
-
-
Method Details
-
mapAndPersist
Map the DTO to a BO and persist.- Specified by:
mapAndPersistin interfaceJpaAssignmentService<HouseRentalDTO,HouseRentalBO> - Parameters:
rentalDTO-- Returns:
- DTO mapped from the persisted BO with its primary key
-
queryByRentalDateRange
public List<HouseRentalDTO> queryByRentalDateRange(LocalDate startInclusive, LocalDate endInclusive) Implement a JPQL named query.- Specified by:
queryByRentalDateRangein interfaceJpaAssignmentService<HouseRentalDTO,HouseRentalBO> - Parameters:
startInclusive-endInclusive-- Returns:
- List of found entries
-
findByHouseIdByDerivedQuery
public org.springframework.data.domain.Page<HouseRentalBO> findByHouseIdByDerivedQuery(String houseId, org.springframework.data.domain.Pageable pageable) Implement a derived query using special method keywords to trigger the correct query.- Specified by:
findByHouseIdByDerivedQueryin interfaceJpaAssignmentService<HouseRentalDTO,HouseRentalBO> - Parameters:
houseId- search only by this IDpageable-- Returns:
- page with found entries
-
findByExample
public org.springframework.data.domain.Page<HouseRentalBO> findByExample(HouseRentalBO probe, org.springframework.data.domain.Pageable pageable) Implement a query by example using the probe provided as an input parameter.- Specified by:
findByExamplein interfaceJpaAssignmentService<HouseRentalDTO,HouseRentalBO> - Parameters:
probe- match provide fieldspageable-- Returns:
- page with found entries
-
findByDateRangeByAnnotatedQuery
public org.springframework.data.domain.Slice<HouseRentalBO> findByDateRangeByAnnotatedQuery(LocalDate startDate, LocalDate endDate, org.springframework.data.domain.Pageable pageable) Implement a query that uses @Query annotation on the repository interface method.- Specified by:
findByDateRangeByAnnotatedQueryin interfaceJpaAssignmentService<HouseRentalDTO,HouseRentalBO> - Parameters:
startDate- inclusiveendDate- inclusivepageable-- Returns:
- slice with found entries
-