Interface PositionTransactionRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<PositionTransaction, Long>, org.springframework.data.jpa.repository.JpaRepository<PositionTransaction, Long>, org.springframework.data.repository.ListCrudRepository<PositionTransaction, Long>, org.springframework.data.repository.ListPagingAndSortingRepository<PositionTransaction, Long>, org.springframework.data.repository.PagingAndSortingRepository<PositionTransaction, Long>, org.springframework.data.repository.query.QueryByExampleExecutor<PositionTransaction>, org.springframework.data.repository.Repository<PositionTransaction, Long>
@Repository
public interface PositionTransactionRepository
extends org.springframework.data.jpa.repository.JpaRepository<PositionTransaction, Long>
Data-access layer for
PositionTransaction entities.- Version:
- 3.0.6
- Author:
- Stephen Prizio
-
Method Summary
Modifier and TypeMethodDescriptionlongcountByPositionId(Long positionId) Counts allPositionTransactions for the given position id.findAllByPosition(Position position) Returns allPositionTransactions for the givenPosition.findByIdAndPosition(Long id, Position position) Returns aPositionTransactionby id for the givenPosition.findByPositionAndExternalTransactionId(Position position, String externalTransactionId) Returns aPositionTransactionby imported external transaction id for the givenPosition.Returns a position transaction matching its request hierarchy and authenticated owner.Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, saveMethods inherited from interface org.springframework.data.jpa.repository.JpaRepository
deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlushMethods inherited from interface org.springframework.data.repository.ListCrudRepository
findAll, findAllById, saveAllMethods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
-
Method Details
-
findOwned
@Query("SELECT pt FROM PositionTransaction pt\nWHERE pt.id = :id\n AND pt.position.positionNumber = :positionNumber\n AND pt.position.account.accountNumber = :accountNumber\n AND pt.position.account.user.id = :userId\n AND pt.position.account.portfolio.active = true\n") Optional<PositionTransaction> findOwned(@Param("id") long id, @Param("positionNumber") long positionNumber, @Param("accountNumber") String accountNumber, @Param("userId") Long userId) Returns a position transaction matching its request hierarchy and authenticated owner.- Parameters:
id- position transaction id decoded from its UIDpositionNumber- position numberaccountNumber- account numberuserId- owning user id- Returns:
OptionalofPositionTransaction
-
findByIdAndPosition
Returns aPositionTransactionby id for the givenPosition.- Parameters:
id- position transaction idposition-Position- Returns:
OptionalPositionTransaction
-
findByPositionAndExternalTransactionId
Optional<PositionTransaction> findByPositionAndExternalTransactionId(Position position, String externalTransactionId) Returns aPositionTransactionby imported external transaction id for the givenPosition.- Parameters:
position-PositionexternalTransactionId- external transaction id- Returns:
OptionalPositionTransaction
-
findAllByPosition
Returns allPositionTransactions for the givenPosition.- Parameters:
position-Position- Returns:
ListofPositionTransactions
-
countByPositionId
Counts allPositionTransactions for the given position id.- Parameters:
positionId- position id- Returns:
- count
-