# @Nationalized probably not working with Hibernate Envers audit

**URL:** <https://discourse.hibernate.org/t/nationalized-probably-not-working-with-hibernate-envers-audit/11992>\
**Category:** Hibernate ORM\
**Created:** [November 29, 2025, 7:54pm UTC](https://discourse.hibernate.org/t/nationalized-probably-not-working-with-hibernate-envers-audit/11992 "2025-11-29T19:54:24Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mehrdad\_Bozorgmehr](https://avatars.discourse-cdn.com/v4/letter/m/d07c76/32.png) [@Mehrdad\_Bozorgmehr](https://discourse.hibernate.org/u/Mehrdad_Bozorgmehr)\
**Post date:** [November 29, 2025, 7:54pm UTC](https://discourse.hibernate.org/t/nationalized-probably-not-working-with-hibernate-envers-audit/11992/1 "2025-11-29T19:54:24Z")

</div>

I am using Spring Boot with Hibernate Envers to manage audit tables in a SQL Server database.

To optimize performance and handle non-Unicode strings properly, I updated my SQL Server connection string as follows:

`spring.datasource.url=jdbc:sqlserver://localhost:1433;databaseName=mydb;sendStringParametersAsUnicode=false`

---

<div class="post-metadata">

**Author:** ![beikov](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/beikov/32/258_2.png) [@beikov](https://discourse.hibernate.org/u/beikov)\
**Post date:** [December 1, 2025, 12:00pm UTC](https://discourse.hibernate.org/t/nationalized-probably-not-working-with-hibernate-envers-audit/11992/2 "2025-12-01T12:00:36Z")

</div>

Soo, what’s the problem? I don’t understand why you’re even posting this..

---

<div class="post-metadata">

**Author:** ![Mehrdad\_Bozorgmehr](https://avatars.discourse-cdn.com/v4/letter/m/d07c76/32.png) [@Mehrdad\_Bozorgmehr](https://discourse.hibernate.org/u/Mehrdad_Bozorgmehr)\
**Post date:** [December 1, 2025, 8:13pm UTC](https://discourse.hibernate.org/t/nationalized-probably-not-working-with-hibernate-envers-audit/11992/3 "2025-12-01T20:13:29Z")

</div>

I fixed it, but the problem is very clear: nationalized doesn’t work for enverse, and the audit table does save.?? in column

---

<div class="post-metadata">

**Author:** ![beikov](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/beikov/32/258_2.png) [@beikov](https://discourse.hibernate.org/u/beikov)\
**Post date:** [December 2, 2025, 11:46am UTC](https://discourse.hibernate.org/t/nationalized-probably-not-working-with-hibernate-envers-audit/11992/4 "2025-12-02T11:46:01Z")

</div>

I don’t understand what you expect. The [documentation for the `sendStringParametersAsUnicode` connection string property](https://learn.microsoft.com/en-us/sql/connect/jdbc/reference/setsendstringparametersasunicode-method-sqlserverdatasource?view=sql-server-ver17) clearly states that it will send data in ASCII format, so if you send non-ASCII characters, you’re simply gonna send rubbish to the server.

---

<div class="post-metadata">

**Author:** ![Mehrdad\_Bozorgmehr](https://avatars.discourse-cdn.com/v4/letter/m/d07c76/32.png) [@Mehrdad\_Bozorgmehr](https://discourse.hibernate.org/u/Mehrdad_Bozorgmehr)\
**Post date:** [December 3, 2025, 7:40pm UTC](https://discourse.hibernate.org/t/nationalized-probably-not-working-with-hibernate-envers-audit/11992/5 "2025-12-03T19:40:20Z")

</div>

> [@beikov](#):
>
> you’re simply gonna send rubbish to the server.

I think you do not have experience in international companies. For example, first names, last names, or addresses of any region need to be saved in the database using their local language, and they usually should not be in ASCII. and it’s very important data”

@Nationalized worked in Hibernate, but doesnt work in Envers to send NVARCHAR to db in this mode

---

<div class="post-metadata">

**Author:** ![beikov](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/beikov/32/258_2.png) [@beikov](https://discourse.hibernate.org/u/beikov)\
**Post date:** [December 4, 2025, 10:41am UTC](https://discourse.hibernate.org/t/nationalized-probably-not-working-with-hibernate-envers-audit/11992/6 "2025-12-04T10:41:15Z")

</div>

So let’s break down what seems to be happening

- The JVM stores your character data in a Unicode encoding as `String`.
- You set a field annotated as `@Nationalized` to a value containing non-ASCII characters
- Hibernate ORM sends that data to the JDBC driver by calling `PreparedStatement#setNString`
- The driver sends rubbish to the server, probably because you configured this setting

Now, how did you come to the conclusion that it is Hibernate ORM is at fault here?

Unless you can provide actual evidence that Hibernate ORM does something wrong, you can try and ask if the [Microsoft SQL Server JDBC driver team](https://github.com/microsoft/mssql-jdbc) can help you with the little information you provided here so far.

Maybe there is a bug somewhere in Hibernate ORM, but with the information you shared here so far, nobody would be able to help you. Try asking a colleague who has no idea about the actual issue you’re facing if the topic you created here has enough information for someone, who isn’t you, to understand what the problem is.

---

<div class="post-metadata">

**Author:** ![Mehrdad\_Bozorgmehr](https://avatars.discourse-cdn.com/v4/letter/m/d07c76/32.png) [@Mehrdad\_Bozorgmehr](https://discourse.hibernate.org/u/Mehrdad_Bozorgmehr)\
**Post date:** [December 4, 2025, 2:32pm UTC](https://discourse.hibernate.org/t/nationalized-probably-not-working-with-hibernate-envers-audit/11992/7 "2025-12-04T14:32:17Z")

</div>

I’m sorry I shared my problem with you; it’s quite clear, but I think you may not fully recognize the issue. It’s actually pretty straightforward.

To improve performance when using an SQL database, you should set `sendStringParametersAsUnicode=false` to ensure that strings are sent to the database by default with JDBC. This allows properly handling of nationalized characters (send NString)in the columns. However, I’ve noticed that the audit tables do not work with nationalized characters and instead show “??” in the audit table.

Before proceeding to judge, please research this topic online or set up this environment on your local machine.

This issue is common on the internet.

> <https://stackoverflow.com/questions/79282368/nationalized-probably-not-working-with-hibernate-envers-audit>

> **[SQL Server JDBC - Set sendStringParametersAsUnicode to false](https://vladmihalcea.com/sql-server-jdbc-sendstringparametersasunicode/)**
>
> Learn why you should always disable the sendStringParametersAsUnicode default JDBC Driver setting when using SQL Server.

But I solved it. I can help you if you’re facing SQL issues with this configuration.

---

<div class="post-metadata">

**Author:** ![beikov](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/beikov/32/258_2.png) [@beikov](https://discourse.hibernate.org/u/beikov)\
**Post date:** [December 4, 2025, 3:36pm UTC](https://discourse.hibernate.org/t/nationalized-probably-not-working-with-hibernate-envers-audit/11992/8 "2025-12-04T15:36:14Z")

</div>

After looking a bit deeper into this matter, I realized that there is in fact a bug and created [HHH-19976](https://hibernate.atlassian.net/browse/HHH-19976) to track this.  
Thanks for reporting it, but next time you report something, please try to create a reproducer with our [test case template](https://github.com/hibernate/hibernate-test-case-templates/blob/master/orm/hibernate-orm-7/src/test/java/org/hibernate/bugs/JPAUnitTestCase.java) and or at least gather some details about what you think might be wrong.  
As you can imagine, we get a lot of questions/requests which are simply the wrongdoing of users and it’s not easy for us maintainers to delve into every user scenario.

---

<div class="post-metadata">

**Author:** ![Mehrdad\_Bozorgmehr](https://avatars.discourse-cdn.com/v4/letter/m/d07c76/32.png) [@Mehrdad\_Bozorgmehr](https://discourse.hibernate.org/u/Mehrdad_Bozorgmehr)\
**Post date:** [December 4, 2025, 9:14pm UTC](https://discourse.hibernate.org/t/nationalized-probably-not-working-with-hibernate-envers-audit/11992/9 "2025-12-04T21:14:43Z")

</div>

I still believe that the first question is clear if you examine the audit table in different scenarios. This is my solution until support for the audit table includes a version of Hibernate for the audit entities using the @Nationalized annotation:

> <https://stackoverflow.com/questions/79282368/nationalized-probably-not-working-with-hibernate-envers-audit/79838355#79838355>

Thanks for fixing this in the future

---

<div class="post-metadata">

**Author:** ![Mehrdad\_Bozorgmehr](https://avatars.discourse-cdn.com/v4/letter/m/d07c76/32.png) [@Mehrdad\_Bozorgmehr](https://discourse.hibernate.org/u/Mehrdad_Bozorgmehr)\
**Post date:** [December 5, 2025, 3:52pm UTC](https://discourse.hibernate.org/t/nationalized-probably-not-working-with-hibernate-envers-audit/11992/10 "2025-12-05T15:52:34Z")

</div>

@beikov Can you assign this task to me? I’d like to do that.

---

<div class="post-metadata">

**Author:** ![beikov](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/beikov/32/258_2.png) [@beikov](https://discourse.hibernate.org/u/beikov)\
**Post date:** [December 5, 2025, 4:08pm UTC](https://discourse.hibernate.org/t/nationalized-probably-not-working-with-hibernate-envers-audit/11992/11 "2025-12-05T16:08:46Z")

</div>

As you can see on the ticket, I already started working on it and have a fix: [HHH-19976 Don't adopt AdjustableBasicType name to create derived type by beikov · Pull Request #11384 · hibernate/hibernate-orm · GitHub](https://github.com/hibernate/hibernate-orm/pull/11384)

---

<div class="post-metadata">

**Author:** ![Mehrdad\_Bozorgmehr](https://avatars.discourse-cdn.com/v4/letter/m/d07c76/32.png) [@Mehrdad\_Bozorgmehr](https://discourse.hibernate.org/u/Mehrdad_Bozorgmehr)\
**Post date:** [December 5, 2025, 4:23pm UTC](https://discourse.hibernate.org/t/nationalized-probably-not-working-with-hibernate-envers-audit/11992/12 "2025-12-05T16:23:44Z")

</div>

Oh, that’s great. I really wanted to fix this bug myself.
