Package com.Server.repository
Interface ReservationRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<Reservation,java.lang.Integer>,org.springframework.data.jpa.repository.JpaRepository<Reservation,java.lang.Integer>,org.springframework.data.repository.PagingAndSortingRepository<Reservation,java.lang.Integer>,org.springframework.data.repository.query.QueryByExampleExecutor<Reservation>,org.springframework.data.repository.Repository<Reservation,java.lang.Integer>
@Repository public interface ReservationRepository extends org.springframework.data.jpa.repository.JpaRepository<Reservation,java.lang.Integer>
Interface repository reservation to available connect on table database.
- Since:
- 2020-12-29.
- Version:
- 1.0
- Author:
- Krystian Cwioro Kamil Bieniasz Damian Mierzynski.
-
Method Summary
Modifier and Type Method Description intdeleteByIdrent(java.lang.Long id)Delete reservation on id.booleanexistsByCar_Idcar(int id)Check whether reservation on id car exist.booleanexistsByIdrent(java.lang.Long id)Check whether reservation on id exist.java.util.List<Reservation>findByCar_Idcar(int id)find a reservation on id carjava.util.Optional<Reservation>findByIdrent(java.lang.Long id)Find reservation on idjava.util.List<Reservation>findCurrent(java.lang.Long id)java.util.Optional<Reservation>findFirstByCarIdcarOrderByIdrentDesc(int id)Find the Last reservation on carMethods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteById, existsById, findById, saveMethods inherited from interface org.springframework.data.jpa.repository.JpaRepository
deleteAllInBatch, deleteInBatch, findAll, findAll, findAll, findAll, findAllById, flush, getOne, saveAll, saveAndFlushMethods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findOne
-
Method Details
-
findByIdrent
Find reservation on id- Parameters:
id- id reservation.- Returns:
- reservation data.
-
existsByCar_Idcar
boolean existsByCar_Idcar(int id)Check whether reservation on id car exist.- Parameters:
id- id car.- Returns:
- true or false.
-
existsByIdrent
boolean existsByIdrent(java.lang.Long id)Check whether reservation on id exist.- Parameters:
id- id reservation.- Returns:
- true or false.
-
findCurrent
@Query("SELECT r FROM Reservation r WHERE r.user.id =:id and r.dataTo >= CURRENT_TIMESTAMP ") java.util.List<Reservation> findCurrent(@Param("id") java.lang.Long id) -
deleteByIdrent
int deleteByIdrent(java.lang.Long id)Delete reservation on id.- Parameters:
id- id reservation.- Returns:
- return int on id delete reservation.
-
findByCar_Idcar
find a reservation on id car- Parameters:
id- id car- Returns:
- return List Reservation.
-
findFirstByCarIdcarOrderByIdrentDesc
Find the Last reservation on car- Parameters:
id- id car.- Returns:
- data reservation.
-