Interface ExchangeRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<Exchange,Long>, org.springframework.data.jpa.repository.JpaRepository<Exchange, Long>, org.springframework.data.jpa.repository.JpaSpecificationExecutor<Exchange>, org.springframework.data.repository.ListCrudRepository<Exchange, Long>, org.springframework.data.repository.ListPagingAndSortingRepository<Exchange, Long>, org.springframework.data.repository.PagingAndSortingRepository<Exchange, Long>, org.springframework.data.repository.query.QueryByExampleExecutor<Exchange>, org.springframework.data.repository.Repository<Exchange, Long>
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.data.jpa.repository.JpaSpecificationExecutor
org.springframework.data.jpa.repository.JpaSpecificationExecutor.SpecificationFluentQuery<T> -
Method Summary
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.jpa.repository.JpaSpecificationExecutor
count, count, delete, delete, exists, exists, findAll, findAll, findAll, findAll, findAll, findBy, findBy, findOne, findOne, updateMethods 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
-
findExchangeByMicIgnoreCase
-
upsertExchange
@Modifying(flushAutomatically=true) @Transactional @Query(value=" INSERT INTO exchanges (\n mic,\n name,\n exchange_operator,\n city,\n country,\n timezone,\n currency,\n trading_hours\n )\n VALUES (\n :mic,\n :name,\n :operator,\n :city,\n :country,\n :timezone,\n :currency,\n :tradingHours\n )\n ON CONFLICT (mic)\n DO UPDATE SET\n name = EXCLUDED.name,\n exchange_operator = EXCLUDED.exchange_operator,\n city = EXCLUDED.city,\n country = EXCLUDED.country,\n timezone = EXCLUDED.timezone,\n currency = EXCLUDED.currency,\n trading_hours = EXCLUDED.trading_hours,\n modified_at = GREATEST(\n exchanges.created_at,\n clock_timestamp() AT TIME ZONE 'UTC'\n )\n WHERE\n exchanges.name IS DISTINCT FROM EXCLUDED.name\n OR exchanges.exchange_operator IS DISTINCT FROM EXCLUDED.exchange_operator\n OR exchanges.city IS DISTINCT FROM EXCLUDED.city\n OR exchanges.country IS DISTINCT FROM EXCLUDED.country\n OR exchanges.timezone IS DISTINCT FROM EXCLUDED.timezone\n OR exchanges.currency IS DISTINCT FROM EXCLUDED.currency\n OR exchanges.trading_hours IS DISTINCT FROM EXCLUDED.trading_hours\n", nativeQuery=true) int upsertExchange(@Param("mic") String mic, @Param("name") String name, @Param("operator") String operator, @Param("city") String city, @Param("country") String country, @Param("timezone") String timezone, @Param("currency") String currency, @Param("tradingHours") String tradingHours) Inserts or updates an existingExchange.- Parameters:
mic- exchange MICname- exchange nameoperator- operatorcity- citycountry- country codetimezone- timezonecurrency- currency codetradingHours- trading hours- Returns:
- number of entries inserted or updated
-