Package api.mpba.rastvdmy.repository
Interface BankIdentityRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<BankIdentity,
,UUID> org.springframework.data.jpa.repository.JpaRepository<BankIdentity,
,UUID> org.springframework.data.repository.ListCrudRepository<BankIdentity,
,UUID> org.springframework.data.repository.ListPagingAndSortingRepository<BankIdentity,
,UUID> org.springframework.data.repository.PagingAndSortingRepository<BankIdentity,
,UUID> org.springframework.data.repository.query.QueryByExampleExecutor<BankIdentity>
,org.springframework.data.repository.Repository<BankIdentity,
UUID>
@Repository
public interface BankIdentityRepository
extends org.springframework.data.jpa.repository.JpaRepository<BankIdentity,UUID>
Repository interface for managing bank identities in the database.
It extends JpaRepository, providing basic CRUD operations and JPA-related methods.
-
Method Summary
Modifier and TypeMethodDescriptionFinds all bank identities associated with a specific user profile ID.findByNameAndConnectedToUserId
(String bankName, UUID userId) Finds a bank identity by its name, connected to a specific user ID.findByUserIdAndBankNameWithAccounts
(UUID userId, String bankName) Finds a bank identity by user ID and bank name, fetching associated bank accounts.findByUserProfileIdAndBankName
(UUID userId, String bankName) Finds a bank identity by user profile ID and bank name.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, 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.PagingAndSortingRepository
findAll
Methods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
-
Method Details
-
findAllByUserProfileId
Finds all bank identities associated with a specific user profile ID.- Parameters:
id
- The ID of the user profile.- Returns:
- An optional list of bank identities linked to the provided user profile ID.
-
findByNameAndConnectedToUserId
@Query("SELECT b FROM BankIdentity b JOIN b.userProfile u WHERE b.bankName = :bankName AND u.id = :userId") Optional<BankIdentity> findByNameAndConnectedToUserId(String bankName, UUID userId) Finds a bank identity by its name, connected to a specific user ID.- Parameters:
bankName
- The name of the bank.userId
- The ID of the user profile.- Returns:
- An optional bank identity matching the provided bank name and user ID.
-
findByUserIdAndBankNameWithAccounts
@Query("SELECT b FROM BankIdentity b LEFT JOIN FETCH b.bankAccounts WHERE b.userProfile.id = :userId AND b.bankName = :bankName") Optional<BankIdentity> findByUserIdAndBankNameWithAccounts(@Param("userId") UUID userId, @Param("bankName") String bankName) Finds a bank identity by user ID and bank name, fetching associated bank accounts.- Parameters:
userId
- The ID of the user profile.bankName
- The name of the bank.- Returns:
- An optional bank identity linked to the provided user ID and bank name, including its associated bank accounts.
-
findByUserProfileIdAndBankName
Finds a bank identity by user profile ID and bank name.- Parameters:
userId
- The ID of the user profile.bankName
- The name of the bank.- Returns:
- An optional bank identity matching the provided user ID and bank name.
-