Okay, this was silly. They are named "properties" but actually they are just column names. So if I have a plain SQL and I know the names of the colum names then I don't need a QueryDefinition at all. Suppose we have a list of column names called "colNames" for a SQL query:
public void loadAllItems() {
String sql = buildSQL();
List<Map<String, Object>> query = DB.rows(sql, new RowBounds(0, maxRows+1));
this.rows = new ArrayList<Item>();
for (Map<String,Object> row : query) {
Item item = new PropertysetItem();
for (Object colName : this.colNames) {
Object value = row.get(colName);
if (value!=null) {
item.addItemProperty(colName, new ObjectProperty(value));
}
}
this.rows.add(item);
}
}