Skip to content

Selecting an object or object[] like with session.list()

gert-wijns edited this page Sep 12, 2014 · 2 revisions

To select a single value it doesn't make sense to make use of a result dto. In such a case, use query.select(value).

Person person = query.from(Person.class);
query.select(person);

=> "select hobj1 from Person hobj1"

To select an array of values, use the query.select(value) method multiple times. There is no reason to use this method of value selection though.

Person person = query.from(Person.class);
query.select(person.getId());
query.select(person.getName());

=> "select hobj1.id, hobj1.name from Person hobj1"
Clone this wiki locally