本文整理了Java中com.j256.ormlite.dao.Dao.deleteIds()
方法的一些代码示例,展示了Dao.deleteIds()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Dao.deleteIds()
方法的具体详情如下:
包路径:com.j256.ormlite.dao.Dao
类名称:Dao
方法名:deleteIds
[英]Delete the objects that match the collection of ids from the database using an IN SQL clause.
[中]使用IN SQL子句从数据库中删除与ID集合匹配的对象。
代码示例来源:origin: org.mycontroller.standalone/mycontroller-core
public void deleteByIds(List<Tid> ids) {
try {
Integer count = this.getDao().deleteIds(ids);
_logger.debug("Ids:[{}] deleted, Delete count:{}", ids, count);
} catch (SQLException ex) {
_logger.error("unable to delete Ids:[{}]", ids, ex);
}
}
代码示例来源:origin: org.mycontroller.standalone/mycontroller-core
@Override
public void delete(List<Integer> ids) {
try {
int count = this.getDao().deleteIds(ids);
_logger.debug("Ids:[{}] deleted, Delete count:{}", ids, count);
} catch (SQLException ex) {
_logger.error("unable to delete logs:[{}]", ids, ex);
}
}
}
代码示例来源:origin: j256/ormlite-core
/**
* @see Dao#deleteIds(Collection)
*/
@Override
public int deleteIds(Collection<ID> ids) {
try {
return dao.deleteIds(ids);
} catch (SQLException e) {
logMessage(e, "deleteIds threw exception on: " + ids);
throw new RuntimeException(e);
}
}
代码示例来源:origin: com.j256.ormlite/ormlite-core
/**
* @see Dao#deleteIds(Collection)
*/
@Override
public int deleteIds(Collection<ID> ids) {
try {
return dao.deleteIds(ids);
} catch (SQLException e) {
logMessage(e, "deleteIds threw exception on: " + ids);
throw new RuntimeException(e);
}
}
代码示例来源:origin: org.mycontroller.standalone/mycontroller-core
@Override
public void delete(List<Integer> ids) {
try {
int deleteCount = this.getDao().deleteIds(ids);
_logger.debug("Deleted [ids:{}], delete count:{}", ids, deleteCount);
} catch (SQLException ex) {
_logger.debug("unable to deleted [ids:{}]", ids, ex);
}
}
代码示例来源:origin: mycontroller-org/mycontroller
@Override
public void delete(List<Integer> ids) {
try {
int deleteCount = this.getDao().deleteIds(ids);
_logger.debug("Deleted [ids:{}], delete count:{}", ids, deleteCount);
} catch (SQLException ex) {
_logger.debug("unable to deleted [ids:{}]", ids, ex);
throw new McDatabaseException(ex);
}
}
代码示例来源:origin: mycontroller-org/mycontroller
public void deleteByIds(List<Tid> ids) {
try {
Integer count = this.getDao().deleteIds(ids);
_logger.debug("Ids:[{}] deleted, Delete count:{}", ids, count);
} catch (SQLException ex) {
_logger.error("unable to delete Ids:[{}]", ids, ex);
throw new McDatabaseException(ex);
}
}
代码示例来源:origin: mycontroller-org/mycontroller
@Override
public void delete(List<Integer> ids) {
try {
int count = this.getDao().deleteIds(ids);
_logger.debug("Ids:[{}] deleted, Delete count:{}", ids, count);
} catch (SQLException ex) {
_logger.error("unable to delete logs:[{}]", ids, ex);
throw new McDatabaseException(ex);
}
}
}
代码示例来源:origin: jclehner/rxdroid
public static <E extends Entry> void deleteByIds(Class<? extends Entry> clazz, Collection<Integer> ids)
{
final Dao<? extends Entry, Integer> dao = getDaoChecked(clazz);
try
{
dao.deleteIds(ids);
}
catch(SQLException e)
{
throw new WrappedCheckedException(e);
}
}
代码示例来源:origin: j256/ormlite-core
@Test(expected = RuntimeException.class)
public void testDeleteIdsThrow() throws Exception {
@SuppressWarnings("unchecked")
Dao<Foo, String> dao = (Dao<Foo, String>) createMock(Dao.class);
RuntimeExceptionDao<Foo, String> rtDao = new RuntimeExceptionDao<Foo, String>(dao);
expect(dao.deleteIds(null)).andThrow(new SQLException("Testing catch"));
replay(dao);
rtDao.deleteIds(null);
verify(dao);
}
代码示例来源:origin: com.j256.ormlite/ormlite-jdbc
@Test
public void testDeleteIdsNone() throws Exception {
Dao<Foo, Integer> fooDao = createDao(Foo.class, true);
List<Integer> fooIdList = new ArrayList<Integer>();
assertEquals(fooIdList.size(), fooDao.deleteIds(fooIdList));
assertEquals(0, fooDao.queryForAll().size());
}
代码示例来源:origin: j256/ormlite-core
@Test(expected = SQLException.class)
public void testDeleteIdsNoId() throws Exception {
Dao<NoId, Object> noIdDao = createDao(NoId.class, true);
NoId noId = new NoId();
noId.stuff = "1";
assertEquals(1, noIdDao.create(noId));
ArrayList<Object> noIdList = new ArrayList<Object>();
noIdList.add(noId);
noIdDao.deleteIds(noIdList);
}
代码示例来源:origin: com.j256.ormlite/ormlite-jdbc
@Test
public void testDeleteIds() throws Exception {
final Dao<Foo, Integer> fooDao = createDao(Foo.class, true);
final List<Integer> fooIdList = new ArrayList<Integer>();
fooDao.callBatchTasks(new Callable<Void>() {
@Override
public Void call() throws Exception {
for (int i = 0; i < 100; i++) {
Foo foo = new Foo();
assertEquals(1, fooDao.create(foo));
fooIdList.add(foo.id);
}
return null;
}
});
assertEquals(fooIdList.size(), fooDao.deleteIds(fooIdList));
assertEquals(0, fooDao.queryForAll().size());
}
代码示例来源:origin: j256/ormlite-core
@Test(expected = SQLException.class)
public void testDeleteIdsThrow() throws Exception {
Dao<Foo, Integer> dao = createDao(Foo.class, true);
Foo foo = new Foo();
assertEquals(1, dao.create(foo));
DatabaseConnection conn = connectionSource.getReadWriteConnection(FOO_TABLE_NAME);
try {
conn.close();
List<Integer> foos = new ArrayList<Integer>();
foos.add(foo.id);
dao.deleteIds(foos);
} finally {
connectionSource.releaseConnection(conn);
}
}
代码示例来源:origin: j256/ormlite-core
@Test
public void testDeleteIds() throws Exception {
Dao<Foo, Integer> dao = createDao(Foo.class, true);
Foo foo1 = new Foo();
assertEquals(1, dao.create(foo1));
Foo foo2 = new Foo();
assertEquals(1, dao.create(foo2));
assertNotNull(dao.queryForId(foo1.id));
assertNotNull(dao.queryForId(foo2.id));
List<Integer> ids = new ArrayList<Integer>();
ids.add(foo1.id);
ids.add(foo2.id);
assertEquals(2, dao.deleteIds(ids));
assertEquals(0, dao.queryForAll().size());
assertNull(dao.queryForId(foo1.id));
assertNull(dao.queryForId(foo2.id));
}
代码示例来源:origin: com.j256.ormlite/ormlite-jdbc
idList.add(id1);
idList.add(id2);
assertEquals(2, dao.deleteIds(idList));
assertNull(dao.queryForId(id1));
assertNull(dao.queryForId(id2));
内容来源于网络,如有侵权,请联系作者删除!