0

I'm using org.hibernate.Session#saveOrUpdate(myObj) to do insert and updates. Using MSSQL.

If a field is a non-Latin character, the raw SQL update MyTable set myfield=N'myFieldValue' where id = 12345; is needed.

Is there a way to automate this escape value in Hibernate so that non Latin columns are saved correctly?

theAnonymous
  • 1,701
  • 2
  • 28
  • 62
  • The answer depends on which database you're using, e.g. PostgreSQL JDBC does everything in Unicode, so there's nothing to do there. Without knowing your database vendor, we can't tell you what you might need to do, if anything. – Andreas Nov 18 '19 at 05:37
  • db is microsoft's db. pls ask for clarification instead of just voting to close. – theAnonymous Nov 18 '19 at 05:42
  • Then say that in the question, e.g. by tagging `sql-server` – Andreas Nov 18 '19 at 05:43
  • See [Specifying type of String while setting parameter value in Hibernate](https://stackoverflow.com/q/37528748/5221149) and [Getting Hibernate and SQL Server to play nice with VARCHAR and NVARCHAR](https://stackoverflow.com/q/5237280/5221149) – Andreas Nov 18 '19 at 05:47

0 Answers0