Search code examples
javasql-serverhibernatejpa

Opposite of @Nationalized hibernate annotation


I am looking for the opposite of @nationalized hibernate annotation. When specifying spring.jpa.properties.hibernate.use_nationalized_character_data =true nationalization is the default behaviour, but how can I create an exception if I have some column that is not nationalized?


Solution

  • You can annotate the columns which should not be nationalized with @JdbcType(VarcharJdbcType.class). The annotation allows you to specify an explicit JdbcType for a column and overwrites the default nationalization behaviour defined by hibernate.use_nationalized_character_data.

    Tested with Hibernate 6.2.26.