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

Environment

Java 1.6, Oracle 10g database, ojdbc6:11.2.0.3

Status

Assignee

Unassigned

Reporter

Alex Edwards

Fix versions

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

4.3.0.Final

Priority

Major