I am using Room Persistence Library and I am trying to avoid boilerplate code by creating a Generic DAO class, like this
@Dao
public interface PendingTaskDao<V> {
@Query("SELECT * FROM :tableName")
Maybe<List<V>> getAllEntitiesFrom(String tableName);
}
But the compiler complains <table or subquery> expected got : tableName. Is there a way to create Generic DAO, or the library must work that way in order to prevent SQL injection?