gpt4 book ai didi

java - 未知数据类型 : "JSON"

转载 作者:行者123 更新时间:2023-12-02 09:14:02 26 4
gpt4 key购买 nike

我们尝试在 hibernate 中定义一个 json 列,如下所示:

实体类:

@TypeDef( name="CustomType", CustomJSONType.class)
...
@Type( name = "CustomType")
@Column
private JSONObject myColumn;
...

CustomJSONType类实现UserType .

当应用程序运行时,日志显示以下错误跟踪:

2018-02-06 08:46:44.067 ERROR [company-operations-module,,,] 11804 --- [           main] org.hibernate.tool.hbm2ddl.SchemaExport  : HHH000389: Unsuccessful: create table operation (id int4 not null, creation timestamp not null, type varchar(50) not null, request_data json not null, response_data json, status varchar(50) not null, user_id varchar(30), primary key (id)) 
2018-02-06 08:46:44.067 ERROR [operations-module,,,] 11804 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : Unknown data type: "JSON" Unknown data type: "JSON"; SQL statement: create table operation (id int4 not null, creation timestamp not null, type varchar(50) not null, request_data json...) [50004-190]
2018-02-06 08:46:44.067 INFO [operations-module,,,] 11804 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000230: Schema export complete

有什么想法吗?提前致谢。

最佳答案

还可以使用“创建域”选项将 H2 配置为将 JSON 作为文本。例如,在连接 URL 中:

jdbc:h2:~/test;AUTO_SERVER=TRUE;INIT=create domain if not exists json as text

关于java - 未知数据类型 : "JSON",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48638673/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com