public class Professional {
}
@DatabaseTable(tableName = "doctors", daoClass = DoctorDao.class)
public class Doctor extends Professional {
@DatabaseField(columnName = "id", generatedId = true)
Long id;
@DatabaseField(columnName = "name")
String name;
public Doctor() {
}
}
@DatabaseTable(tableName = "blogs", daoClass = BlogDao.class)
public class Blog<T> {
@DatabaseField(columnName = "id", generatedId = true)
Long id;
@DatabaseField(columnName = "title")
String title;
@DatabaseField(columnName = "blog_of", foreign = true, canBeNull = false, foreignAutoCreate = true)
T author;
}
I am unable to create DAO for the Blog class as I am not able to call constructor with generic parameter with class Blog.
The DAO for Blog are :
public interface BlogDaoInterface extends Dao<Blog<? extends Professional>, Long> {
}
public class BlogDao extends BaseDaoImpl<Blog<? extends Professional>, Long> implements BlogDaoInterface {
public BlogDao(ConnectionSource connectionSource) throws SQLException {
super(connectionSource, Blog<? extends Professional>.class);
}
}
ERROR:
The ormlite is not able to create DAO of Blog class(i.e. BlogDao).
I have used ormlite to create tables by the following line of code :
TableUtils.createTableIfNotExists(connectionSource, Blog.class);
But the gradle shows following error:
"cannot select from parametrized type" in the BlogDao class in the following line:
super(connectionSource, Blog<? extends Professional>.class);
Please tell me the correct way of doing it ASAP. I am stuck with this problem for many days and not able to find any solution on internet.
Thanks in advance.