public interface Delete<E> extends Command<Integer>
Delete is a command interface to delete entities match to the
specified Filters in Acid House's transactional session. This
command execution returns the count of deleted entities. You can build &
execute this command as the following code, in App Engine example:
import org.eiichiro.acidhouse.Session;
import org.eiichiro.acidhouse.appengine.AppEngineDatastoreSession;
...
// Creating 'Session' instance.
Session session = new AppEngineDatastoreSession();
// Beginning transaction.
Transaction transaction = session.beginTransaction();
// Getting metamodel instance of 'Entity3' class.
Entity3$ entity3$ = Metamodels.metamodel(Entity3.class);
try {
// Deleting all of 'Entity3' entities which their 'entity1.i' property value
// is less than 15.
session.delete(entity3$)
.filter(entity3$.entity1.i.lessThan(15))
.execute();
// Committing transaction.
transaction.commit();
} catch (Exception e) {
transaction.rollback();
throw e;
} finally {
session.close();
}
Delete<E> filter(Filter<?>... filters)
Filters.
Each of the specified filters is combined with "logical and".filters - Filters to qualify entities to be deleted.Delete to delete entities qualified with the
specified Filters.Copyright © 2009-2014 Eiichiro Uchiumi. All Rights Reserved.