hibernate/hibernate-orm · error · HibernateException

Unrecognized flush mode : {}

Error message

Unrecognized flush mode : {}

What it means

Error "Unrecognized flush mode : {}" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/boot/jaxb/hbm/internal/FlushModeConverter.java:43

		// Also, we want to map "never"->MANUAL (rather than NEVER)
		if ( name == null ) {
			return null;
		}

		if ( "never".equalsIgnoreCase( name ) ) {
			return FlushMode.MANUAL;
		}
		else if ( "auto".equalsIgnoreCase( name ) ) {
			return FlushMode.AUTO;
		}
		else if ( "always".equalsIgnoreCase( name ) ) {
			return FlushMode.ALWAYS;
		}

		// if the incoming value was not null *and* was not one of the pre-defined
		// values, we need to throw an exception.  This *should never happen if the
		// document we are processing conforms to the schema...
		throw new HibernateException( "Unrecognized flush mode : " + name );
	}

	public static String toXml(FlushMode mode) {
		if ( mode == null ) {
			return null;
		}

		// conversely, we want to map MANUAL -> "never" here
		if ( mode == FlushMode.MANUAL ) {
			return "never";
		}

		// todo : what to do if the incoming value does not conform to allowed values?
		// for now, we simply don't deal with that (we write it out).

		return mode.name().toLowerCase( Locale.ENGLISH );
	}
}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Use a valid flush mode value in the hbm.xml: ALWAYS, AUTO, COMMIT, or MANUAL.
  2. Fix typos or case errors in the flush-mode attribute.
  3. Remove the attribute to inherit the default flush mode.

When it happens

Trigger: An unrecognized flush mode value appears in a mapping document.

Common situations: A typo or unsupported value in the flush-mode attribute of a legacy hbm.xml mapping.


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