HHH-20092 SqlTypes.JSON on SQL Server expects varchar(max) even with use_nationalized_character_data=true#11680
HHH-20092 SqlTypes.JSON on SQL Server expects varchar(max) even with use_nationalized_character_data=true#11680qlfyd123 wants to merge 14 commits intohibernate:mainfrom
Conversation
hibernate-core/src/main/java/org/hibernate/dialect/SQLServerDialect.java
Outdated
Show resolved
Hide resolved
hibernate-core/src/test/java/org/hibernate/orm/test/dialect/SQLServerDialectTest.java
Outdated
Show resolved
Hide resolved
hibernate-core/src/main/java/org/hibernate/dialect/SQLServerDialect.java
Show resolved
Hide resolved
|
@mbellade |
hibernate-core/src/main/java/org/hibernate/dialect/SQLServerDialect.java
Outdated
Show resolved
Hide resolved
|
Hi @mbellade.
I would appreciate guidance on the correct design direction: I'm happy to adjust the implementation based on your feedback. For now, I've pushed the changes to facilitate discussion despite the test failure. |
|
Given that the JSON data type or alternative we're using on all other databases is able to store all characters (not just ASCII), I think it might be best to default to add the following to the jdbcTypeRegistry.addDescriptor( JsonAsStringJdbcType.NVARCHAR_INSTANCE );
jdbcTypeRegistry.addDescriptor( XmlAsStringJdbcType.NVARCHAR_INSTANCE );Or maybe even do that in the Instead of validating the column type, can you please write a test that stores a unicode character into a JSON string and verify that it comes out the same way again? See |
|
Hi @beikov |
beikov
left a comment
There was a problem hiding this comment.
Please make sure this single test JsonUnicodeMappingTests works on all databases.
...re/src/test/java/org/hibernate/orm/test/mapping/basic/SqlServerNationalizedMappingTests.java
Outdated
Show resolved
Hide resolved
...re/src/test/java/org/hibernate/orm/test/mapping/basic/SqlServerNationalizedMappingTests.java
Outdated
Show resolved
Hide resolved
...re/src/test/java/org/hibernate/orm/test/mapping/basic/SqlServerNationalizedMappingTests.java
Outdated
Show resolved
Hide resolved
...re/src/test/java/org/hibernate/orm/test/mapping/basic/SqlServerNationalizedMappingTests.java
Outdated
Show resolved
Hide resolved
...re/src/test/java/org/hibernate/orm/test/mapping/basic/SqlServerNationalizedMappingTests.java
Outdated
Show resolved
Hide resolved
...re/src/test/java/org/hibernate/orm/test/mapping/basic/SqlServerNationalizedMappingTests.java
Outdated
Show resolved
Hide resolved
...re/src/test/java/org/hibernate/orm/test/mapping/basic/SqlServerNationalizedMappingTests.java
Outdated
Show resolved
Hide resolved
...-core/src/test/java/org/hibernate/orm/test/mapping/basic/SybaseNationalizedMappingTests.java
Outdated
Show resolved
Hide resolved
...-core/src/test/java/org/hibernate/orm/test/schemavalidation/SQLServerJsonValidationTest.java
Outdated
Show resolved
Hide resolved
|
@beikov |
...te-core/src/test/java/org/hibernate/orm/test/mapping/basic/NationalizedJsonMappingTests.java
Outdated
Show resolved
Hide resolved
|
@beikov |
|
It seems we will need to merge #11989 first to get rid of the failure for Sybase. |
hibernate-core/src/main/java/org/hibernate/dialect/SybaseDialect.java
Outdated
Show resolved
Hide resolved
|
@beikov |
beikov
left a comment
There was a problem hiding this comment.
Thanks. Please also apply consistent formatting.
hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/NClobJdbcType.java
Outdated
Show resolved
Hide resolved
hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/NClobJdbcType.java
Outdated
Show resolved
Hide resolved
|
@beikov I revert STREAM_BINDING binder change and fix import formatting. |
beikov
left a comment
There was a problem hiding this comment.
The formatting is still a bit off. Note that we usually have a space character before and after parenthesis, as well as the ? and : ternary operator parts.
hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/NClobJdbcType.java
Outdated
Show resolved
Hide resolved
hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/NClobJdbcType.java
Outdated
Show resolved
Hide resolved
hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/NClobJdbcType.java
Outdated
Show resolved
Hide resolved
hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/NClobJdbcType.java
Outdated
Show resolved
Hide resolved
hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/NClobJdbcType.java
Outdated
Show resolved
Hide resolved
hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/NClobJdbcType.java
Outdated
Show resolved
Hide resolved
hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/NVarcharJdbcType.java
Outdated
Show resolved
Hide resolved
hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/NVarcharJdbcType.java
Outdated
Show resolved
Hide resolved
|
@beikov Sorry about that — I re-applied the formatting. |
|
|
I'm sorry this takes so long, but the jTDS driver was posing a problem which wasn't easy to solve. I cleaned up the code now and created a new PR: #12105 |


https://hibernate.atlassian.net/browse/HHH-20092
[Please describe here what your change is about]
Added a descriptor to DdlTypeRegistry to map json to nvarchar.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.
Please make sure that the following tasks are completed:
Tasks specific to HHH-20092 (Bug):
migration-guide.adocOR check there are no breaking changes