Using Room I am trying to fetch data from two tables (Company and Farm) into a single list. Using commonsware answer I created a base class CompanyFarmBase and two child classes Company and Farm. Now using the example I created Dao class with following code:
@Query("SELECT * FROM farm_table")
fun getAllFarm(): List<UserModel.Farm>
@Query("SELECT * FROM company_table")
fun getAllCompany(): List<UserModel.Company>
@Transaction
fun getAllCompanyFarm(): List<UserModel.CompanyFarmBase> {
val result = ArrayList<UserModel.CompanyFarmBase>()
result.addAll(getAllCompany())
result.addAll(getAllFarm())
return result
}
Now when I try to build I get these errors:
dao/FarmDao_Impl.java:100: error: illegal start of expression
List<UserModel.CompanyFarmBase> _result = FarmDao.DefaultImpls.getAllCompanyFarm(this, );
dagger.internal.codegen.ComponentProcessor was unable to process com.navdeep.di.component.AppComponent because not all of its dependencies could be resolved. Check for compilation errors or a circular dependency with generated code.
Please let me know where I went wrong. Querying separately each table gives proper data. Thanks!