admin管理员组

文章数量:1306926

I have a POJO class which I want to copy values to corresponding jOOQ record. This is the pseudo code:

var record = dslContext.fetchOptional(tbl, pkField.eq(pkValue)).get()
record.from(dto);
record.store();

The difference between "dto" and "record" is in a field called "formula" where it is "true" string in record but something else in the DTO. However, after "from" call, still record has the old value for formula field and it is not updated.

Look like in AbstractRecord.from0, the call to Tools.configuration(this).recordUnmapperProvider().provide(source.getClass(), (FieldsImpl) fields.fields).unmap(prepareArrayOrIterableForUnmap(source, targetIndexMapping)),returns an object where my value is reset the what was there in the record, not what is in the source.

Is the way I'm doing update wrong?

BTW, the POJO class is generated via jOOQ itself.

I found something new. In the call to getInstanceMethods in Tools it returns a set of methods that are used to find out which 'getter' to use to get value for a field to then set field value in the Record. Problem is, I also have a 'is_formula' field there. So my guess is, sometimes this isFormula() getter appears before formula() and as a result, isFormula() is called to get the value for record.formula.

本文标签: javaRecordfrom(POJO) seems to ignore a fieldStack Overflow