hibernate/hibernate-orm · error · IllegalArgumentException

value must be a string or integer: {}

Error message

value must be a string or integer: {}

What it means

Error "value must be a string or integer: {}" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/jpa/internal/util/ConfigurationHelper.java:92

	}

	private static FlushMode getFlushMode(FlushModeType flushMode)  {
		return switch ( flushMode ) {
			case AUTO -> FlushMode.AUTO;
			case COMMIT -> FlushMode.COMMIT;
			case EXPLICIT ->  FlushMode.MANUAL;
		};
	}

	public static Integer getInteger(Object value) {
		if ( value instanceof Integer integer ) {
			return integer;
		}
		else if ( value instanceof String string ) {
			return Integer.valueOf( string );
		}
		else {
			throw new IllegalArgumentException( "value must be a string or integer: " + value );
		}
	}

	public static Boolean getBoolean(Object value) {
		if ( value instanceof Boolean bool ) {
			return bool;
		}
		else if ( value instanceof String string ) {
			return Boolean.valueOf( string );
		}
		else {
			throw new IllegalArgumentException( "value must be a string or boolean: " + value );
		}
	}

	public static CacheMode getCacheMode(Object value) {
		if ( value == null ) {
			return null;

View on GitHub (pinned to fad1729dce)

Solutions

  1. Provide the configuration value as a String or Integer; convert other types before setting the property.

When it happens

Trigger: Thrown at hibernate-core/src/main/java/org/hibernate/jpa/internal/util/ConfigurationHelper.java:92 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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