spring-data-relational icon indicating copy to clipboard operation
spring-data-relational copied to clipboard

Ability to change default sql type mappings [DATAJDBC-526]

Open spring-projects-issues opened this issue 5 years ago • 4 comments

Alexander Gladskoy opened DATAJDBC-526 and commented

Please provide ability to bind parameter to non-default sql-type. For example I have this code

@Query("update someTable set stringAttr = :stringAttr where id = :id")
int updateString(@Param("id") long id, @Param("stringAttr") String stringAttr);

And I want the parameter stringAttr to be binded to NVARCHAR instead of default VARCHAR


Issue Links:

spring-projects-issues avatar Apr 28 '20 11:04 spring-projects-issues

Jeffrey Wayne Castellow commented

Use this setting sendStringParametersAsUnicode=true

in yml,

append to the datasource url : jdbc

or in 

tomcat "connection-properties:"

 

 

spring-projects-issues avatar Nov 19 '20 16:11 spring-projects-issues

Jens Schauder commented

This should be possible once we have SpEL support: DATAJDBC-397

spring-projects-issues avatar Nov 23 '20 06:11 spring-projects-issues

Jeffrey Wayne Castellow commented

I would like to ask, the reverse, I have just upgraded to  Spring Boot 2.3.2, and I want to to prevent binding to NVARCHAR and instead use the of default VARCHAR. We have no Unicode in out system and NVARCHAR is suddenly drastically affecting performance. 

This setting that used to work now does not work after the upgrade:  sendStringParametersAsUnicode=false

Can you shed some light on this? 

spring-projects-issues avatar Nov 23 '20 20:11 spring-projects-issues

Jens Schauder commented

jeffreycw1 that is an unrelated issue. Please create a new issue and include a reproducer demonstrating the problem

spring-projects-issues avatar Nov 24 '20 07:11 spring-projects-issues