Hello, 2015-07-10 10:13 GMT+02:00 <[email protected]>:
> Hi, > > I am facing a problem in jOOQ. We have a query with a multiple join, and I > want to have only a small subset of the Record received. The problem is > that we have multple "ID" columns and when I execute > > BenefitRecord r = record.into(BenefitRecord.class); > > > The field r.ID is not the one of BenefitRecord, is the one of Users > because the SQL is: > > List<Benefit> benefits = getContext().select().from(USERS) > ... Another joins > > .join(BENEFIT_SNAPSHOT).onKey(Keys.BENEFIT_SNAPSHOT__BENEFIT_SNAPSHOT_LOYALTY_ITEM_SNAPSHOT_FK) > > Yes, that has been confusing numerous users. The problem is that your BenefitRecord is regarded as a POJO, which is why the DefaultRecordMapper applies its standard mapping algorithm, which does not take into account the table from which a column originates - only the column name. A valid workaround in this case is to use Record.into(Table), instead: http://www.jooq.org/javadoc/latest/org/jooq/Record.html#into-org.jooq.Table- > Also it is strange for me that this sentence returns false: > > record.field(Tables.BENEFIT.ID).equals(Tables.BENEFIT.ID); > > > I am doing something wrong? > That's indeed curious. What jOOQ version are you using? -- 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.
