Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Hibernate JPA@Lob属性编码不适用于PostgreSQL文本 JPA映射_Hibernate_Postgresql_Jpa_Encoding_Lob - Fatal编程技术网

Hibernate JPA@Lob属性编码不适用于PostgreSQL文本 JPA映射

Hibernate JPA@Lob属性编码不适用于PostgreSQL文本 JPA映射,hibernate,postgresql,jpa,encoding,lob,Hibernate,Postgresql,Jpa,Encoding,Lob,我将JPA与Hibernate一起使用。我有一个具有@Lob属性的实体 @Column(nullable=false) @Lob private String text; 我使用的是PostgreSQL 8.4,实体与列正确映射 "text" text NOT NULL 我的视图页面使用UTF-8编码,我的URL连接也使用正确的编码: <property name="url" value="jdbc:postgresql://myhos

我将JPA与Hibernate一起使用。我有一个具有@Lob属性的实体

@Column(nullable=false)
@Lob
private String text;
我使用的是PostgreSQL 8.4,实体与列正确映射

"text" text NOT NULL
我的视图页面使用UTF-8编码,我的URL连接也使用正确的编码:

<property name="url" value="jdbc:postgresql://myhostip:port/mydb?useUnicode=yes&amp;characterEncoding=UTF-8" />

另外,我的客户机在posgreSQL上的编码是Unicode(使用查询工具)或UTF-8(使用psql)

问题 虽然我可以读取/保存数据,但当我显示数据时,存在一些编码问题,如显示��.

另一个信息是,在同一个实体上,我有另一个字符串属性,对于@Lob属性的相同内容,这些属性都正确显示

我还将text属性从psql导出到test.txt文件,内容正常


在持久化(调试)之前,我已经测试了属性的值,并且该值是正确的。

基于尝试在
@Type(Type=“org.hibernate.Type.StringClobType”)
之后添加注释
@Lob

,就是这样@D0dger!解决了我的问题!非常感谢你!最新的情况是,它不起作用。找不到类org.hibernate.type.StringClobType是否尝试过
org.hibernate.type.MaterializedClobType
?仅供参考:正确的PostgreSQL的JDBC参数是
charSet=UTF-8
()