hibernate/hibernate-orm · error · UnsupportedOperationException

Nationalized character data not supported on this database

Error message

Nationalized character data not supported on this database

What it means

NationalizationSupport.UNSUPPORTED.getCharVariantCode throws: the current dialect declared no nationalized character support at all, so there is no NCHAR-equivalent JDBC type code to return. It fires whenever code asks for the nationalized char/varchar/clob code on a dialect whose support level is UNSUPPORTED.

Solutions

  1. Remove @Nationalized from the mapping.
  2. Use a database that supports national character types.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Triggered when the application calls a Hibernate dialect feature that the configured database dialect cannot provide: Nationalized character data not supported on this database.

Common situations: Common when running against a database whose dialect lacks this capability, when a mapping or HQL/Criteria query requests unsupported functionality, or when the wrong dialect is configured for the database in use. Error: Nationalized character data not supported on this database.


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/0783684821e790b3. Report an issue: GitHub.

Appendix: source

Thrown at hibernate-core/src/main/java/org/hibernate/dialect/NationalizationSupport.java:44

	/**
	 * The database does define and support distinct SQL types
	 * for representing nationalized character data, typically
	 * named {@code NCHAR}, {@code NVARCHAR}, and {@code NCLOB}.
	 */
	EXPLICIT,

	/**
	 * The database does not even have support for nationalized
	 * character data.
	 */
	UNSUPPORTED;

	public int getCharVariantCode() {
		return switch ( this ) {
			case IMPLICIT -> Types.CHAR;
			case EXPLICIT -> Types.NCHAR;
			case UNSUPPORTED -> throw new UnsupportedOperationException("Nationalized character data not supported on this database");
		};
	}

	public int getVarcharVariantCode() {
		return switch ( this ) {
			case IMPLICIT -> Types.VARCHAR;
			case EXPLICIT -> Types.NVARCHAR;
			case UNSUPPORTED -> throw new UnsupportedOperationException("Nationalized character data not supported on this database");
		};
	}

	public int getLongVarcharVariantCode() {
		return switch ( this ) {
			case IMPLICIT -> Types.LONGVARCHAR;
			case EXPLICIT -> Types.LONGNVARCHAR;
			case UNSUPPORTED -> throw new UnsupportedOperationException("Nationalized character data not supported on this database");
		};
	}

View on GitHub (pinned to fad1729dce)