NClob handing using MaterializedNClobType does not save unicode characters

Description

When using the MaterializedNClobType data is saved to the database with unicode characters corrupted. (e.g. \u2018 is written to the database as ¿ )

e.g.
@Column(name = "TXT")
@Type(type = "org.hibernate.type.MaterializedNClobType")
@Lob
private String text;

I have traced it down to a couple of bugs:
1. When using STREAM_BINDING the code in NClobTypeDescriptor calls st.setCharacterStream instead of st.setNCharacterStream
2. When using NCLOB_BINDING the code in StringTypeDescriptor.unwrap will always shortcut at the Clob condition (therefore returing a Clob) and will never reach the code that creates an NClob

Activity

Show:

Yoni Amir January 11, 2017 at 8:39 PM

I don't think it is correct to simply close this bug. When not using JDBC-level streams, the problem still occurs.

Yoni Amir December 30, 2016 at 9:28 PM

I don't know how to change the "affects version" field, maybe I don't have permissions to edit this bug report. However, I can confirm it happens in version 5.2.6-Final.

Yoni Amir December 30, 2016 at 9:24 PM

When using streams, the issue doesn't happen in version 5 anymore. However, when using clobs/nclobs directly, the issue still happens, the problematic code is in StringTypeDescriptor as explained in the description

Steve Ebersole October 28, 2015 at 3:26 AM

As part of verifying that this issue affects 5.0, please just set the "Affects version". Leave the "verify-affects-5.0" label and leave the issue in "Awaiting Response" status; these are critical for us to be able to track these verifications and triage them. Thanks.

Steve Ebersole October 27, 2015 at 7:15 PM

This bug report does not indicate that the reported issue affects version 5.x. Versions prior to 5.x are no longer maintained. It would be a great help to the Hibernate team and community for someone to verify that the reported issue still affects version 5.x. If so, please add the 5.x version that you verified with to the list of affected-versions and attach the (preferably SSCCE) test case you used to do the verification to the report; from there the issues will be looked at during our triage meetings.

For details, see http://in.relation.to/2015/10/27/great-jira-cleanup-2015/

Out of Date

Details

Assignee

Reporter

Labels

Components

Affects versions

Priority

Created January 30, 2014 at 12:35 AM
Updated January 11, 2017 at 8:39 PM
Resolved December 31, 2016 at 7:23 AM