When using NamedParameterJdbcTemplate, NVARCHAR or NCLOB(4000 characters or less) columns are not properly populated since StatementCreatorUtils does setString for these types instead of setNString. [SPR-16154] #20702
Labels
in: data
Issues in data modules (jdbc, orm, oxm, tx)
status: backported
An issue that has been backported to maintenance branches
type: bug
A general bug
Milestone
Jeff Maxwell opened SPR-16154 and commented
When using
NamedParameterJdbcTemplate
,NVARCHAR
orNCLOB
(4000 characters or less) columns are not properly populated sinceStatementCreatorUtils
usessetString
for these types instead ofsetNString
.Before #16555
NVARCHAR
columns would populate correctly as the logic falls back tosetObject
sinceNVARCHAR
andLONGNVARCHAR
are not explicitly handled.After #16555
setString
is called forNVARCHAR
(andLONGNVARCHAR
) causing the data to be stored with theNLS_CHARACTERSET
and not theNLS_NCHAR_CHARACTERSET
.This commit handles
NCLOBs
properly but only if they are greater than 4000 characters.Note that
NCHAR
works fine as it still handled bysetObject
.The updated
setValue
method is below.Environment
Affects: 4.3.12, 5.0.1
Issue Links:
Referenced from: pull request #1586, and commits d5f34ed, e4c5b77, a37fce8
Backported to: 4.3.13
The text was updated successfully, but these errors were encountered: