public interface Update<E> extends Command<Integer>
Update is a command interface to update properties of
Session entity matches to the specified Filters with the specified
value in Acid House's transactional session.
This command execution returns the count of updated entities. You can build
& execute this command as the following code:
import org.eiichiro.acidhouse.Session;
import org.eiichiro.acidhouse.appengine.AppEngineDatastoreSession;
...
Session session = new AppEngineDatastoreSession();
Transaction transaction = session.beginTransaction();
try {
session.update(Entity3.class)
.set(entity3$.i, 100)
.set(entity3$.entity1.i, new Modification<Integer>() {
public Integer apply(Integer from) {
return from + 10;
}
})
.filter(entity3$.id.equalTo("Key1"))
.execute();
transaction.commit();
} catch (Exception e) {
transaction.rollback();
throw e;
} finally {
session.close();
}
| Modifier and Type | Interface and Description |
|---|---|
static interface |
Update.Modification<T>
Modification function applied to the property to be updated.
|
| Modifier and Type | Method and Description |
|---|---|
Update<E> |
filter(Filter<?>... filters)
Qualifies entities to be updated with the specified
Filters. |
<T> Update<E> |
set(Property<?,T> property,
T value)
Qualifies property and the value to be updated.
|
<T> Update<E> |
set(Property<?,T> property,
Update.Modification<T> modification)
Qualifies property to be updated and the modification function.
|
<T> Update<E> set(Property<?,T> property, T value)
property - The property to be updated by this
Update.value - The property value to be updated to.Update to update the specified entity
properties.<T> Update<E> set(Property<?,T> property, Update.Modification<T> modification)
property - The property to be updated by this
Update.modification - The modification function applied to the property.Update to update the specified entity
properties.Update<E> filter(Filter<?>... filters)
Filters.
Each of the specified filters is combined with "logical and".filters - Filters to qualify entities to be updated.Update to update entities qualified with the
specified Filters.Copyright © 2009-2014 Eiichiro Uchiumi. All Rights Reserved.