Interface RoomRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<Room,Long>, org.springframework.data.jpa.repository.JpaRepository<Room,Long>, org.springframework.data.repository.ListCrudRepository<Room,Long>, org.springframework.data.repository.ListPagingAndSortingRepository<Room,Long>, org.springframework.data.repository.PagingAndSortingRepository<Room,Long>, org.springframework.data.repository.query.QueryByExampleExecutor<Room>, org.springframework.data.repository.Repository<Room,Long>

@Table(name="rooms") public interface RoomRepository extends org.springframework.data.jpa.repository.JpaRepository<Room,Long>
Fetches/saves Rooms from/to the database table rooms.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    delete(@NonNull Room room)
    Permanently removes the given Room from the database.
    boolean
    existsByNumber(@NonNull String number)
    Checks whether a Room with the given Room.number is present in the database.
    @NonNull org.springframework.data.domain.Page<Room>
    findAll(@NonNull org.springframework.data.domain.Pageable pageable)
    A subset of all Rooms in the database table according to the given Pageable.
    Fetches all room numbers present on any Rooms in the database.
    @NonNull Optional<Room>
    findRoomByNumber(@NonNull String number)
    Fetches the Room with the specified Room.number from the database table.

    Methods inherited from interface org.springframework.data.repository.CrudRepository

    count, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, save

    Methods inherited from interface org.springframework.data.jpa.repository.JpaRepository

    deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlush

    Methods inherited from interface org.springframework.data.repository.ListCrudRepository

    findAll, findAllById, saveAll

    Methods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository

    findAll

    Methods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor

    count, exists, findAll, findBy, findOne
  • Method Details

    • findAll

      @NonNull @NonNull org.springframework.data.domain.Page<Room> findAll(@NonNull @NonNull org.springframework.data.domain.Pageable pageable)
      A subset of all Rooms in the database table according to the given Pageable.
      Specified by:
      findAll in interface org.springframework.data.repository.PagingAndSortingRepository<Room,Long>
      Parameters:
      pageable - The pagination information specifying which page of Rooms shall be returned.
      Returns:
      All Rooms, but only the specified subset.
    • findRoomByNumber

      @NonNull @NonNull Optional<Room> findRoomByNumber(@NonNull @NonNull String number)
      Fetches the Room with the specified Room.number from the database table.
      Parameters:
      number - The number of the room that is being looked for.
      Returns:
      The Room matching the given number, if it exists.
    • findAllRoomNumbers

      @Query("select r.number from Room r") @NonNull @NonNull LinkedHashSet<String> findAllRoomNumbers()
      Fetches all room numbers present on any Rooms in the database.
      Returns:
      All room numbers in the database.
    • delete

      void delete(@NonNull @NonNull Room room)
      Permanently removes the given Room from the database.
      Specified by:
      delete in interface org.springframework.data.repository.CrudRepository<Room,Long>
      Parameters:
      room - The Room that shall no longer be available for booking.
    • existsByNumber

      boolean existsByNumber(@NonNull @NonNull String number)
      Checks whether a Room with the given Room.number is present in the database.
      Parameters:
      number - The Room number to check.
      Returns:
      True if a Room with the number exists, false otherwise.