Sorry for the confusion. Just wanted to be sure there wasn't a misunderstanding.
2017-11-29 16:24 GMT+01:00 <[email protected]>: > As for my use-case, I suppose it was just an idea to implement an extra > check on the SQL query. jOOQ already generates classes based on the actual > tables, but when writing code there is nothing really stopping me from > writing a query that selects a set of columns but then tries to fetch the > result from a completely different column that was never queried for in the > first place. > Yeah, that sort of type safety can't really be guaranteed by the jOOQ API, unfortunately, as Java doesn't support anonymous record types (yet). One option would be to call Record1.value1(), in case of which you can be sure of the field to exist, but you're back to referencing values by index, which is certainly less readable. > The mock-tests catches stuff like this, but I noticed that it didn't catch > me using the wrong column name altogether. It's a minor thing, but I was > curious to see if it would be possible to catch this scenario as well. > I don't think it is. You'd have to get deep into jOOQ and mock Records themselves, which is currently not possible, although it might be possible once we implement this: https://github.com/jOOQ/jOOQ/issues/3313 Essentially, a jOOQ Record is a Map<Field<?>, ?>... Thanks, Lukas -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
