From 7f4363814c781358c901fd112385f457a1f6e308 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Thu, 22 Apr 2021 23:44:28 +0300 Subject: [PATCH] selects from joined tables need explicit column list :( --- .../java/net/ktnx/mobileledger/dao/TransactionDAO.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/net/ktnx/mobileledger/dao/TransactionDAO.java b/app/src/main/java/net/ktnx/mobileledger/dao/TransactionDAO.java index 7d91728f..29fe1c66 100644 --- a/app/src/main/java/net/ktnx/mobileledger/dao/TransactionDAO.java +++ b/app/src/main/java/net/ktnx/mobileledger/dao/TransactionDAO.java @@ -84,10 +84,11 @@ public abstract class TransactionDAO extends BaseDAO { public abstract TransactionWithAccounts getFirstByDescriptionSync(@NonNull String description); @androidx.room.Transaction - @Query("SELECT * from transactions tr JOIN transaction_accounts t_a ON t_a.transaction_id = " + - "tr.id WHERE tr.description = :description AND t_a.account_name LIKE " + - "'%'||:accountTerm||'%' ORDER BY year desc, month desc, day desc, tr.ledger_id desc " + - "LIMIT 1") + @Query("SELECT tr.id, tr.profile_id, tr.ledger_id, tr.description, tr.data_hash, tr.comment, " + + "tr.year, tr.month, tr.day, tr.generation from transactions tr JOIN " + + "transaction_accounts t_a ON t_a.transaction_id = tr.id WHERE tr.description = " + + ":description AND t_a.account_name LIKE '%'||:accountTerm||'%' ORDER BY year desc, " + + "month desc, day desc, tr.ledger_id desc LIMIT 1") public abstract TransactionWithAccounts getFirstByDescriptionHavingAccountSync( @NonNull String description, @NonNull String accountTerm); -- 2.39.5