使用 jooQ 在 Vertica 中写入 UUID
write UUID in Vertica with jooQ
我没有 jOOQ 生成的 classes,所以,我想使用我的 class 并将其写入 vertica。
Table<Record> table = DSL.table(DATA_TABLE_NAME);
for (Data d : data) {
dsl.insertInto(table, Arrays.asList(
DSL.field(name("uuid"), SQLDataType.UUID)
))
.values(
d.getUuid(),
).execute();
}
在 PostgreSql 中可以,但在 Vertica 中会生成此异常
[Vertica][VJDBC](2631) ERROR: Column "uuid" is of type uuid but expression is of type varchar
如何在不生成 class 的情况下编写 uuid tu Vertica? d.getUuid() returns java.Util.UUID
UUID
类型在Vertica中比较新颖。从 jOOQ 3.13 开始,还不支持开箱即用:
https://github.com/jOOQ/jOOQ/issues/10073
您必须为此查询创建自己的 custom data type binding,并将其附加到您的 SQLDataType.UUID
,例如
DSL.field(name("uuid"), SQLDataType.UUID.asConvertedDataType(new MyVerticaUUIDBinding()));
我没有 jOOQ 生成的 classes,所以,我想使用我的 class 并将其写入 vertica。
Table<Record> table = DSL.table(DATA_TABLE_NAME);
for (Data d : data) {
dsl.insertInto(table, Arrays.asList(
DSL.field(name("uuid"), SQLDataType.UUID)
))
.values(
d.getUuid(),
).execute();
}
在 PostgreSql 中可以,但在 Vertica 中会生成此异常
[Vertica][VJDBC](2631) ERROR: Column "uuid" is of type uuid but expression is of type varchar
如何在不生成 class 的情况下编写 uuid tu Vertica? d.getUuid() returns java.Util.UUID
UUID
类型在Vertica中比较新颖。从 jOOQ 3.13 开始,还不支持开箱即用:
https://github.com/jOOQ/jOOQ/issues/10073
您必须为此查询创建自己的 custom data type binding,并将其附加到您的 SQLDataType.UUID
,例如
DSL.field(name("uuid"), SQLDataType.UUID.asConvertedDataType(new MyVerticaUUIDBinding()));