简体   繁体   中英

how delete all rows with no SQL

Is the any other way to delete all rows of a database table without writing an SQL delete statement?

List<Item> items = Ebean.find(Item.class).findList();
Ebean.delete(items);

Is there anything like

Ebean.deleteAll(Item.class)

in Ebean API?

Indeed it exists, check this out

Delete all the beans from a Collection.

public static int delete(Collection<?> c)
                  throws javax.persistence.OptimisticLockException

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM