It would be great if it were easy to have a Record implementation that delegated to another, especially for the generated record classes.
Example use case 1: I have a record that maps to a few rows joined together from 2-3 tables. I can set fields on it using the (verbose) non-typesafe methods, but it would be great to use generated setFoo(), setBar(), etc methods. I can't go record.into(FirstTable.class).setFoo() because that creates a copy - it would be great if I could easily go FirstTable.wrap(record).setFoo(x) and have that setFoo() method delegate to the underlying wrapped record, SecondTable.wrap(record).setBar(y) affects the same record, and so on. Example use case 2: Disambiguate fields. If I go dsl.select()... with some joins, and the table field names clash, jooq / sql will not complain because when generating the SQL jooq disambiguates the field names with tables. However in the returned records, it seems that table names are ignored and whatever fields came last clobber earlier fields (usually one would prefer the other way round, but that's not 100% of the time either). Being able to get a specific "view" of the record would again be very helpful, e.g. FooTable.wrap(record).getId() vs BarTable.wrap(record).getId(). Of course that doesn't disambiguate the case of table aliasing but that should be easily handled with modest extensions to this concept. I think this would be more convenient than being forced to explicitly list all the fields to select() and aliasing the clashing ones. How does this sound? Or is there a better way to achieve 1/2? Dan -- 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/groups/opt_out.
