简体   繁体   中英

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 . 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

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.

As of jOOQ 3.11, this isn't possible out of the box. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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