Interface OrderRepository

  • All Superinterfaces:
    org.springframework.data.repository.CrudRepository<Order,​Long>, org.springframework.data.jpa.repository.JpaRepository<Order,​Long>, org.springframework.data.repository.PagingAndSortingRepository<Order,​Long>, org.springframework.data.repository.query.QueryByExampleExecutor<Order>, org.springframework.data.repository.Repository<Order,​Long>

    @Repository
    public interface OrderRepository
    extends org.springframework.data.jpa.repository.JpaRepository<Order,​Long>
    Order repository.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      List<Order> findByOrderByTimestampAsc()
      Retrieve all orders (sorted by timestamp).
      Optional<Order> findByOrderId​(String orderId)
      Find an order by its order id.
      List<Order> findByStatus​(OrderStatusDTO orderStatusDTO)
      Find orders with a specific status.
      List<Order> findByStatusNot​(OrderStatusDTO orderStatusDTO)
      Find orders without a specific status.
      void updateAmount​(Long id, BigDecimal value)
      Update order amount.
      • Methods inherited from interface org.springframework.data.repository.CrudRepository

        count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, save
      • Methods inherited from interface org.springframework.data.jpa.repository.JpaRepository

        deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, findAll, findAll, findAllById, flush, getById, getOne, saveAll, saveAllAndFlush, saveAndFlush
      • Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository

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

        count, exists, findAll, findOne
    • Method Detail

      • findByOrderId

        Optional<Order> findByOrderId​(String orderId)
        Find an order by its order id.
        Parameters:
        orderId - order id
        Returns:
        order
      • findByStatus

        List<Order> findByStatus​(OrderStatusDTO orderStatusDTO)
        Find orders with a specific status.
        Parameters:
        orderStatusDTO - order status
        Returns:
        orders
      • findByStatusNot

        List<Order> findByStatusNot​(OrderStatusDTO orderStatusDTO)
        Find orders without a specific status.
        Parameters:
        orderStatusDTO - order status
        Returns:
        orders
      • findByOrderByTimestampAsc

        List<Order> findByOrderByTimestampAsc()
        Retrieve all orders (sorted by timestamp).
        Returns:
        orders
      • updateAmount

        @Transactional
        @Modifying
        @Query("update Order o set o.amount.value = :value where o.id = :id")
        void updateAmount​(@Param("id")
                          Long id,
                          @Param("value")
                          BigDecimal value)
        Update order amount. WARNING: Only used by the dry mode, please do not use.
        Parameters:
        id - order id
        value - new amount