Вот DAO, который я создал для библиотеки комнат со списком участников. Данные очень простые.
package com.example.tag;
import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;
import java.util.List;
@Dao
public interface ParticipantDAO {
@Query("SELECT * FROM Participants ORDER BY Name")
LiveData<List<Participant>> getAllParticipants();
@Query("SELECT * FROM Participants LIMIT 1")
Participant[] getAnyParticipant;
@Insert
void insert(Participant participant);
@Update
void update(Participant participant);
@Delete
void delete(Participant participant);
@Query("DELETE FROM Participants")
void deleteAll();
}
Проблема со вторым оператором @Query
(getAnyParticipant). Я получаю сообщение об ошибке: "'@Query' not applicable to field"
.
Я пытаюсь изменить android обучающие программы для своих нужд (используя участников вместо слов), расположенные здесь: https://codelabs.developers.google.com/codelabs/android-training-room-delete-data/index.html?index=..%2F..android-training#2
Что я делаю не так?