Closed djmailhot closed 4 years ago
We can try updating TransactionRepository.java to return a default value when no transactions are found:
32 @Query("SELECT ISNULL(MAX(transactionId),'-1') FROM Transaction")
33 Long latestId();
This approach seems to work:
/**
* Returns the id of the latest transaction, or -1 if no transactions exist.
*/
@Query(value = "SELECT COALESCE("
+ "(SELECT MAX(transaction_id) FROM transactions), "
+ "CAST ('-1' AS BIGINT))",
nativeQuery = true)
Long latestId();
The balance reader service is unable to correctly instantiate when there are no transactions in the database. It hits an issue with retrieving TransactionRepository.latestId() and getting a Null value.