Interface OrderRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<Order,Long>, org.springframework.data.jpa.repository.JpaRepository<Order,Long>, org.springframework.data.jpa.repository.JpaSpecificationExecutor<Order>, 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>, org.springframework.data.jpa.repository.JpaSpecificationExecutor<Order>
Order repository.
  • Method Summary

    Modifier and Type
    Method
    Description
    Retrieve all orders (sorted by timestamp).
    Find an order by its order id.
    findByStatus(OrderStatusDTO orderStatusDTO)
    Find orders with a specific status.
    Find orders with a status different from the one passed as a parameter.
    void
    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.jpa.repository.JpaSpecificationExecutor

    count, findAll, findAll, findAll, findOne

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

    findAll

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

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

    • 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 with a status different from the one passed as a parameter.
      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.uid = :uid") void updateAmount(@Param("uid") Long uid, @Param("value") BigDecimal value)
      Update order amount. WARNING: Only used by the dry mode, please do not use it.
      Parameters:
      uid - order uid
      value - new amount