I have just updated my Spring Boot project from 2.1.7.RELEASE to 2.7.10. I use SQL Server database where some of columns encrypted using Always Encrypted (via Java Keystore).
Before the update everthing went well. After the update there is an error.
There is a form with these fields: A [nullable], B, C. All of them are strings and A is encrypted in the database and it has a org.hibernate.annotations.Nationalized annotation.
And there is a query the corresponding repository: existsByAAndBAndC. This query fails if A is null but success if A is not null.
Under the hood in the JDBC sp_describe_parameter_encryption call fails with the following error:
The data types nvarchar(255) encrypted with (encryption_type = 'DETERMINISTIC', encryption_algorithm_name = 'AEAD_AES_256_CBC_HMAC_SHA_256', column_encryption_key_name = 'xxx', column_encryption_key_database_name = 'yyy') and varchar(1) encrypted with (encryption_type = 'DETERMINISTIC', encryption_algorithm_name = 'AEAD_AES_256_CBC_HMAC_SHA_256', column_encryption_key_name = 'xxx', column_encryption_key_database_name = 'yy') collation_name = 'zzz' are incompatible in the equal to operator.
At this point Spring/Hibernate/JDBC converts this filed into varchar instead of nvarchar. If the A is not null then it converts to nvarchar and the repo call is success.
Is there any idea?
I have tried number of other versions of Spring Boot, tried @Type annotation also. I expect some other tipps.