Hi Darren, #2989 is now fixed on GitHub master. Along with this fix, I could also fix the related #2836:
- https://github.com/jOOQ/jOOQ/issues/2836 - https://groups.google.com/forum/#!msg/jooq-user/BNWthTVXH7c/nGQwPEcUvzoJ Cheers Lukas 2014-01-29 Lukas Eder <[email protected]>: > I vaguely recall that this was discussed before on this user group. The > reason for the current behaviour is simple. jOOQ treats Class<? extends > Record> like any other POJO class and calls setters after instantiating a > new record. This has the effect of setting all changed flags to "true". > Obviously, this technical reason is unexpected from an API consumer > perspective. It would probably make sense to add some additional logic to > DefaultRecordMapper, that deals with Record subclasses differently in order > to inherit the complete Record state from the original Records (value, > original value, changed flag). I have registered this as #2989: > https://github.com/jOOQ/jOOQ/issues/2989 > > There had been a similar fix in the past, fixing Record.into(Table): > - https://github.com/jOOQ/jOOQ/issues/1522 > - > http://www.jooq.org/javadoc/3.2.x/org/jooq/ResultQuery.html#fetchOneInto(org.jooq.Table) > > I think that this fix can be implemented in a minor release, even if it is > slightly backwards-incompatible from a behaviour perspective. The current > behaviour simply doesn't make sense. > > As a workaround, you can either: > - Patch changed flags after this fetchOneInto() call > - Use fetchOneInto(Table) instead. > > > 2014-01-28 Darren S <[email protected]> > > Say I want to join across some tables, but the result I just care about >> the fields for a particular Record class. So what I've been doing is >> something like this >> >> .select(ACCOUNT.fields()) >> .from(ACCOUNT) >> .join(CREDENTIAL) >> .on(CREDENTIAL.ACCOUNT_ID.eq(ACCOUNT.ID)) >> .where( >> ACCOUNT.STATE.eq(CommonStatesConstants.ACTIVE) >> >> .and(CREDENTIAL.STATE.eq(CommonStatesConstants.ACTIVE)) >> .and(CREDENTIAL.PUBLIC_VALUE.eq(access)) >> .and(CREDENTIAL.SECRET_VALUE.eq(secretKey))) >> .and(CREDENTIAL.KIND.in(SUPPORTED_TYPES.get())) >> .fetchOneInto(AccountRecord.class); >> >> So what I just noticed is that if I do this it marks all fields as >> changed in the record. Is there a difference syntax I'm supposed to be >> using? >> >> Darren >> >> -- >> 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. >> > > -- 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.
