Object Query

Engine API

Engine API Example

In the example will be uset a generic Session, replace it with specific class Session.

Select:
Session session = ....
QueryEngine<Session> engine = QueryEngine.instance(Session.class);
SelectQuery<Person> query = engine.newSelect(Person.class);
...
List<Person> res = (List<Person>)engine.execute(query, session);
Update
Session session = ....
QueryEngine<Session> engine = QueryEngine.instance(Session.class);
UpdateQuery<Person> query = engine.newUpdate(Person.class);
...
int updateCount = engine.execute(query, session);
Delete
Session session = ....
QueryEngine<Session> engine = QueryEngine.instance(Session.class);
DeleteeQuery<Person> query = engine.newDelete(Person.class);
...
int deleteCount = engine.execute(query, session);
Insert
Session session = ....
QueryEngine<Session> engine = QueryEngine.instance(Session.class);
InsertQuery<Person> query = engine.newInsert(Person.class);
...
bolean inserted = engine.execute(query, session);