Follow up. Is it possible to do the above using a plain string SQL query and not building the query "Jooq Style". I dont see any RecordMapper examples on DSLContext.fetch(String SQL) type queries....
On Thursday, December 27, 2018 at 11:52:38 AM UTC-5, Max Kremer wrote: > > AWESOME!!!!! Thanks again Lukas. > > On Thursday, December 27, 2018 at 4:00:38 AM UTC-5, Lukas Eder wrote: >> >> Hi Max, >> >> The DefaultRecordMapper supports mapping things into a pre-existing >> instance, so you can use it in two ways: >> >> - By specifying the Class<E> reference, in case of which you currently >> cannot hook into the instantiation of that class >> - By specifying <E> instance directly, in case of which you're in control >> of that >> >> So, just write >> >> .fetchInto(r -> r.into(new MyRow(helper))); >> >> See: >> - https://www.jooq.org/javadoc/latest/org/jooq/Record.html#into-E- >> - >> https://www.jooq.org/javadoc/latest/org/jooq/impl/DefaultRecordMapper.html >> >> I hope this helps >> Lukas >> >> On Mon, Dec 24, 2018 at 5:28 AM Max Kremer <[email protected]> wrote: >> >>> Hi, >>> >>> Consider the following typical query execution. I am populating a JPA >>> annotated POJO called MyRow >>> >>> d.select( ..) >>> .from( ... ).as("S") >>> .where( ... ) >>> .groupBy(groupByFields) >>> .fetchInto(MyRow.class); >>> >>> What I need to do is pass additional information to the MyRow >>> constructor. How can this be achieved? >>> >>> For example let's say I have a class called *MyRowParserHelper* that is >>> used by the *MyRow* class. I need to pass an instance of the >>> *MyRowParserHelper* >>> (it can be the same instance) to each instance of the *MyRow* class >>> created by the *fetchInto* method. Is this possible? >>> >>> -- >>> 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. >>> >> -- 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.
