> Is that possible to get a typed recordset from a select query in Jooq? > > For now it seems that we need to use Result<Record> which is pretty > generic. I would like it to be something like Result<UserRecord> or > List<UserRecord> if possible to be able to iterate it and get > UserRecord on each iteration.
What you want to do can be achieved using the Factory's selectFrom() method: public final <R extends Record> SimpleSelectWhereStep<R> selectFrom(Table<R> table); As you can see, the signature suggests that you will get the Table's <R> type as a result. Read more on this page (I agree, this might be a little subtle): https://sourceforge.net/apps/trac/jooq/wiki/Manual/JOOQ/Query Also, when you use the selectFrom() method, the resulting TableRecords can be used as documented here (including foreign key navigation): https://sourceforge.net/apps/trac/jooq/wiki/Manual/META/TABLE > For now it seems, that I need to iterate Result<Record> and cast each > record to UserRecord type, right? Casting is only possible if you select all fields from a single table. As soon as you change your projection (SELECT clause), or your join product (FROM clause), you will get RecordImpl instead of TableRecords. But if possible, you should avoid casting, and use the generic type provided by jOOQ's API. Cheers Lukas
