Object Query

Update Tutorial

Example Java Domain

public class Person {
	private String name;
	private String surname;
	private String address;
	private Date birthDate;
	...gets sets...
}

Simple update query building

Update the address of a person.

UpdateQuery<Person> query = new GenericUpdateQuery<Person>(Person.class);
Person toUpdate = query.target();
query.set(toUpdate.getAddress(),"rue de Paris");
query.eq(toUpdate.getAddress(),"rue d'anton");
query.eq(toUpdate.getName(),"elisabeth");

Correspondent Pseudo QL

update Person set address = "rue de Paris" where address="rue d'anton" and name="elisabeth" 

Update with a persistant value

Set the surname equals to surname.

UpdateQuery<Person> query = new GenericUpdateQuery<Person>(Person.class);
Person toUpdate = query.target();
query.set(toUpdate.getSurname().toUpdate.getName());

Correspondent Pseudo QL

update Person set surname = name