Lukasz Antoniak commented on Bug HHH-6127

Strange. I have tested current maser branch, and save operation did not work correctly. Database created with: CREATE DATABASE "hibtest" WITH OWNER "lukasz" ENCODING 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8';.

In my opinion PostgreSQL JDBC driver causes hereby defect. Refer to linked bug report #5637: "JDBC driver method setClob() always uses getAsciiStream()".

Two possible workarounds for Hibernate users:

  1. Annotate @Lob property with @Type(type="org.hibernate.type.StringClobType"). Note that org.hibernate.type.StringClobType is deprecated and new org.hibernate.type.MaterializedClobType does not fix reported case.
  2. Provide custom PostgreSQL dialect as the one attached to JIRA ticket. By now I did not observe any disadvantages of using PreparedStatement#setCharacterStream() method in comparison to PreparedStatement#setClob(). Brett Meyer and Steve Ebersole should have a look. Moreover, after executing some basic load tests (persist CLOB followed by a single read), it seems that stream operations perform better.

Analogical issue rejected by Spring: https://jira.springsource.org/browse/SPR-7520.

Did my suggestions work for you?

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira