刪除數據

2018-05-30 11:42 更新

刪除指定id值的數據代碼如下

String id="id_xxx";
		Template<Product> template=new ProxyTemplate(Product.class).getInstance();
		try 
		{
			template.delete(id);
		} catch (Exception e) {
			e.printStackTrace();
		}finally
		{
			template.close();
		}

可以看到控制臺輸出如下

delete from PRODUCT where ID='id_xxx'

如果需要刪除多條數據時,則調用deletes方法即可,如下


List<String> idList=new LinkedList();
template.deletes(idList);


以上內容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號