I'm Using JPA with Hibernate. I have an entity with a @Lob property
@Column(nullable=false)
@Lob
private String text;
I'm using PostgreSQL 8.4 and the Entity was correctly mapped with the column
"text" text NOT NULL
My view pages are using UTF-8 encoding and my URL Connection is also using the proper encoding:
<property name="url" value="jdbc:postgresql://myhostip:port/mydb?useUnicode=yes&characterEncoding=UTF-8" />
Also, my client_encoding on posgreSQL is Unicode (using Query Tool) or UTF-8 (using psql).
Although I can read/persist the data, when I display it there are some encoding problems like showing ��.
Another information is, on the same entity I have another String properties there are displayed correctly for the same content of the @Lob property.
I have also exported the text property from psql to a test.txt file and the content is ok.
I've tested the value of the property just before persisting (debugging) and the value is correct.
Based on this try to add annotation @Type(type="org.hibernate.type.StringClobType")
after @Lob
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With