Topic
  • No replies
Matt_B
Matt_B
1 Post

Pinned topic RSA 8 with JPA Merge or Persist Unicode values to MS SQL Server 2008 R2

‏2014-01-31T14:25:08Z |
I'm having difficulty with unicode characters saving to SQL Server 2008 R2.  I'm using an EntityManager to persist or merge the entity object which successfully updates and saves to the database but the NVARCHAR column that is used to store unicode characters (in this case a Chinese character) are showing the values as question marks (standard ansi latin characters work fine). 
 
I can edit the DB column in SQL Server directly to confirm that the unicode character can be stored and retrieved correctly (the JPA pulls unicode from the table column just fine).   
I've debugged and confirmed the entity object has the correct unicode characters before the merge or persist.
I have run SQL Profiler to debug the sql statement and the update statement built by the JPA shows the value as question marks.
 
Here is what SQL Profiler is showing me...note the question mark after the datetime:
  
  declare @p1 int
  set @p1=85
  exec sp_prepexec @p1 output,N'@P0 datetime2,@P1 varchar(8000),@P2 bigint',N'UPDATE AAVS000_MESSAGE SET AVS000_LAST_UPDT_S = @P0, AVS000_VALUE_C = @P1 WHERE AVS000_PK_B = @P2                        ','2014-01-28 19:20:59.1640000','?',11
  select @p1
 
I've also tried setting the JDBC parameter "sendStringParametersAsUnicode" to true but that didn't work and I also tried adding to the @Column on the entity with columnDescription="NVARCHAR(50)" with no luck either.
 
I'm using Rational Software Architect 8.0.4 with Websphere 8.0 and SQL Server 2008 R2.   I'm using the RAD JPA 2.0 Platform with the Library Provided by Target Runtime.   I'm using a standard jta-data-source and connecting to the datasource in Websphere.
 
I'm hoping that someone here has run across this issue or can confirm merge and persisting of unicode values in SQL Server with RSA 8 JPA.
 
Thanks for your time,
Matt B.