Kotlin and Android Development featuring Jetpack: error concerning function getCurrentStandings in BaseballDao.java

@mfazio23

I’m following the indications of the book and arriver ad chapter 10, but the app cannot be compiled due to an error in the BaseballDao.java class produced during the build process. I get the following errors:

  • Not sure how to convert a Cursor to this method’s return type (java.lang.Object).
  • Query method parameters should either be a type that can be converted into a database column or a List / Array that contains such type. You can consider adding a Type Adapter for this.
  • Unused parameter: continuation
  • Type of the parameter must be a class annotated with @Entity or a collection/array of it.
  • Not sure how to handle insert method’s return type.
  • Type of the parameter must be a class annotated with @Entity or a collection/array of it.
  • Not sure how to handle insert method’s return type.
  • Type of the parameter must be a class annotated with @Entity or a collection/array of it.
  • Not sure how to handle update method’s return type. Currently the supported return types are void, int or Int.
  • Type of the parameter must be a class annotated with @Entity or a collection/array of it.
  • Not sure how to handle update method’s return type. Currently the supported return types are void, int or Int.
  • The query returns some columns [teamId, division, wins, losses, winsLastTen, streakCount, streakType, divisionGamesBack, leagueGamesBack, id] which are not used by java.lang.Object. You can use @ColumnInfo annotation on the fields to specify the mapping. You can annotate the method with @RewriteQueriesToDropUnusedColumns to direct Room to rewrite your query to avoid fetching unused columns. You can suppress this warning by annotating the method with @SuppressWarnings(RoomWarnings.CURSOR_MISMATCH). Columns returned by the query: teamId, division, wins, losses, winsLastTen, streakCount, streakType, divisionGamesBack, leagueGamesBack, id.

The error message is

C:\Users\ale\AndroidStudioProjects\AndroidBaseballLeague\app\build\tmp\kapt3\stubs\debug\org\mathverse\androidbaseballleague\data\BaseballDao.java:31: error: Not sure how to convert a Cursor to this method’s return type (java.lang.Object).
public abstract java.lang.Object getCurrentStandings(@org.jetbrains.annotations.NotNull()

(I’m using org.mathverse.androidbaseballleague as package name, instead of dev.mfazio.abl).

The BaseballDao.java class contains the following lines

@org.jetbrains.annotations.Nullable()
@androidx.room.Query(value = "SELECT * FROM standings")
public abstract java.lang.Object getCurrentStandings(@org.jetbrains.annotations.NotNull()
kotlin.coroutines.Continuation<? super java.util.List<org.mathverse.androidbaseballleague.standings.TeamStanding>> continuation);

This is the only function of the database having prblems.
How can I solve this issue?
Thanks