简体   繁体   English

是否可以使用客户生成器在JOOQ中将两个数据库字段组合成一个字段?

[英]Is it possible to combine two database fields into one in JOOQ with customer generators?

I'm reading over the docs custom generators and data type rewrites . 我正在阅读docs 定制生成器数据类型重写 It seems like it has a lot of flexibility. 似乎它具有很大的灵活性。 But is it possible to combine two db fields into one? 但是可以将两个数据库字段组合为一个吗?

For example, for foreign exchange, I'd like to store two fields 例如,对于外汇交易,我想存储两个字段

budget.value, budget.currency

Could I somehow have JOOQ convert this to 我能以某种方式将JOOQ转换为

Value getMonetaryValue() {
    return Value(this.value, this.currency);
}

Where in this case Value is a custom enum that I've created to support both value and currency. 在这种情况下, Value是我创建的同时支持值和货币的自定义枚举。

As of jOOQ 3.11, this isn't possible out of the box. 从jOOQ 3.11开始,这是不可能的。 There's a pending feature request and related features that will allow for supporting what JPA calls @Embeddable types: https://github.com/jOOQ/jOOQ/issues/6124 有一个待处理的功能请求和相关功能,将支持JPA所谓的@Embeddable类型: https : //github.com/jOOQ/jOOQ/issues/6124

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM