1

In my application there is a User superclass and Coach and Player classes that extend User. I'd like to be able to use DAO methods like these:

@Query
fun getUsers(): Flowable<List<User>>

and not have to request Coaches and Players separatly. When I try something like this now my generated implementation class is not valid because it tries to create User objects, which is an abstract class.

Is there a way for Room to attain this polymorphic behaviour? Should the User class also have an @Entity tag or not? The User has the UUID that is being used as a Primary key.

HDW
  • 308
  • 2
  • 14

0 Answers0