I am trying to delete records by ids Collection using ormlite i dont know what is the problem, this is my code:
public <T> int deleteRecordsById(Class<T> klass, Collection<?> ids) throws SQLException {
Dao<T, ?> mapper = DaoManager.createDao(connection, klass);
mapper.deleteIds(ids); //here is the problem
}
This is the argument of deleteIds function:
deleteIds(Collection ids) Delete the objects that match the collection of ids from the database using an IN SQL clause.
i get an error:
The method deleteIds(Collection) in the type Dao is not applicable for the arguments (Collection)
I solved the problem:
public <B> int deleteRecordsById(Class<T> klass, List<B> ids) throws SQLException {
Dao<T, B> mapper = DaoManager.createDao(connection, klass);
return mapper.deleteIds(ids);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.