SQLTemplate<Sample> query = Database.sql(Sample.class, sql, Integer.valueOf(userId)); List<DataRow> fetchList = query.fetchListAsDataRow(); List<Sample> list = new ArrayList<Sample>(); for (DataRow row : fetchList) { String lastName = (String) row.get("last_name"); String firstName = (String) row.get("first_name"); Sample object = Database.objectFromRowData(row, Sample.class); object.setFirstName(firstName); object.setLastName(lastName); list.add(object); }