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
版权声明:本文标题:java - Record.from(POJO) seems to ignore a field - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741823510a2399508.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论