“Type of the parameter must be a class annotated with @Entity” while creating Generic DAO interface in Room

后端 未结 4 788
鱼传尺愫
鱼传尺愫 2020-12-16 19:52

I am using Room architecture component for persistence. I have created generic DAO interface to avoid boilerplate code. Room Pro Tips

But my code doesn\'t compile s

4条回答
  •  长情又很酷
    2020-12-16 20:21

    I believe is that you have missed to give Entity annotation to T class. For example Reason class should have @Entity and give it to ReasonDao class. Like:

    @Dao public abstract class ReasonDao extends BaseDao{}

提交回复
热议问题