To select all fields from a connected table source, simply select "none":
Result<Record> result = sql.select().from(Tables.CUSTOMER) .join(Tables.EMPLOYEE) .on(...) .fetch();
jOOQ then examines a known table source and generates all the column references for you. One way to create a POJO relationship is to use one of the Result.intoGroups() methods. For instance:.
Map<Integer, List<Customer>> map = result.intoGroups(CUSTOMER.EMPLOYEE_ID, Customer.class);
This will display the List<Customer> pojos value for EMPLOYEE_ID .
On a side note: as with any mapping operation that calls DefaultRecordMapper , mapping may not work as expected when your JOIN produces the same column name twice (for example, CUSTOMER.ID and EMPLOYEE.ID ) - since DefaultRecordMapper Doesn't know from which table a particular column is coming from.
For more complex comparisons, you should probably implement your own RecordMapperProvider
source share