自动附加新记录
是否可以连接默认配置来创建新记录,而不是每次手动附加?我看到,在执行选择
时,它会自动连接记录,如果我可以跳过此步骤,以获取创建的每个新记录。
var address = new AddressRecord();
address.attach(jooq().configuration());
address.setAddress(addressTemplate.getAddress());
address.setState(addressTemplate.getState());
address.setCity(addressTemplate.getCity());
address.setZipcode(addressTemplate.getZipcode());
address.setCountryId(addressTemplate.getCountryId());
Is it possible to attach a default configuration for creating new records instead of manually attaching each time? I saw that while performing a SELECT
it automatically attaches the record, would be nice if I could skip this step for every new record created.
var address = new AddressRecord();
address.attach(jooq().configuration());
address.setAddress(addressTemplate.getAddress());
address.setState(addressTemplate.getState());
address.setCity(addressTemplate.getCity());
address.setZipcode(addressTemplate.getZipcode());
address.setCountryId(addressTemplate.getCountryId());
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于Java构造函数调用的性质(
new AddressRecord()
),因此无法拦截此类调用,例如将结果对象连接到configuration
。但是您可以使用
jOOQ()。newRecord(address)
,它会产生附带的记录。您还可以使用jOOQ()。newRecord(address,addressTemplate)
使用defaultrecordunmapper
Due to the nature of a Java constructor call (
new AddressRecord()
), it is not possible to intercept such a call e.g. in order to attach the resulting object to aConfiguration
.But you can use
jooq().newRecord(ADDRESS)
instead, which produces an attached record. You can also usejooq().newRecord(ADDRESS, addressTemplate)
to copy values using theDefaultRecordUnmapper