Skip to content
New issue

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

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

Already on GitHub? # to your account

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

Open
spring-projects-issues opened this issue Apr 28, 2020 · 4 comments
Open
Assignees
Labels
type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link

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
Copy link
Author

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
Copy link
Author

Jens Schauder commented

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

@spring-projects-issues
Copy link
Author

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
Copy link
Author

Jens Schauder commented

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

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants