Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NClobTypeHandler should call setNCharacterStream instead of setCharacterStream #3287

Closed
Git-ruijing opened this issue Nov 1, 2024 · 1 comment
Assignees
Labels
Milestone

Comments

@Git-ruijing
Copy link

I'm not a native English speaker, and my English is poor.The following content is translated using gpt.

my database character setting

select * from v$nls_parameters where parameter in ('NLS_LANGUAGE', 'NLS_TERRITORY', 'NLS_CHARACTERSET','NLS_NCHAR_CHARACTERSET');

NLS_LANGUAGE	SIMPLIFIED CHINESE
NLS_TERRITORY	CHINA
NLS_CHARACTERSET	ZHS16GBK
NLS_NCHAR_CHARACTERSET	AL16UTF16

When I try to insert a text into an NCLOB type field, I find that some Unicode characters, such as '\u00a0', are replaced with question marks "?".

I noticed that the setNonNullParameter method in NClobTypeHandler calls ps.setCharacterStream. I tried changing it to ps.setNCharacterStream, and the insert result was correct. I compared NClobTypeHandler and ClobTypeHandler, and they are the same. Why is this?

MyBatis version

3.5.6

Database vendor and version

DBMS: Oracle (ver. Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options)
Case sensitivity: plain=upper, delimited=exact

<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>23.4.0.24.05</version>
@harawata
Copy link
Member

harawata commented Nov 1, 2024

Hello @Git-ruijing ,

Earlier versions had to support Java 1.5, so that probably was the reason (setNCharacterStream() and getNClob() was added in Java 1.6).
If you are keen, please send us a PR.

@harawata harawata changed the title NClobTypeHandler is correct? NClobTypeHandler should call setNCharacterStream instead of setCharacterStream Nov 18, 2024
@harawata harawata added this to the 3.5.17 milestone Nov 18, 2024
@harawata harawata self-assigned this Nov 18, 2024
@harawata harawata added the bug label Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants