hibernate/hibernate-orm · error · UnsupportedOperationException

format() function not supported on Mimer SQL

Error message

format() function not supported on Mimer SQL

What it means

MimerSQLDialect.appendDatetimeFormat() unconditionally throws: Mimer SQL has no date-to-string formatting function that Hibernate's datetime format pattern machinery could target, so the HQL/JPA format() datetime function is declared unsupported rather than silently producing wrong output.

Source

Thrown at hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/MimerSQLDialect.java:328

	@Override
	public LimitHandler getLimitHandler() {
		return OffsetFetchLimitHandler.INSTANCE;
	}

	@Override
	public LockingSupport getLockingSupport() {
		return LockingSupportSimple.NO_OUTER_JOIN;
	}

	@Override
	public boolean supportsOffsetInSubquery() {
		return true;
	}

	@Override
	public void appendDatetimeFormat(SqlAppender appender, String format) {
		throw new UnsupportedOperationException("format() function not supported on Mimer SQL");
	}

	@Override
	public boolean useInputStreamToInsertBlob() {
		return false;
	}

	@Override
	public boolean useConnectionToCreateLob() {
		return false;
	}

	@Override
	public IdentityColumnSupport getIdentityColumnSupport() {
		return MimerSQLIdentityColumnSupport.INSTANCE;
	}

	@Override

View on GitHub (pinned to fad1729dce)

Solutions

  1. Format on the Java side: select the raw timestamp and apply DateTimeFormatter.ofPattern in the mapper/projection
  2. Use extract()-based expressions to build the pieces Mimer supports (year(?2), day(?2), ...) and concatenate them
  3. Register a custom FunctionDescriptor ('format') via a MetadataBuilderContributor that implements formatting with Mimer functions if you need it in SQL

Example fix

// before
List<String> days = session.createQuery(
    "select format(e.occurred, 'yyyy-MM-dd') from Event e", String.class)
    .getResultList(); // UnsupportedOperationException on Mimer

// after - format in Java
List<LocalDateTime> raw = session.createQuery(
    "select e.occurred from Event e", LocalDateTime.class).getResultList();
List<String> days = raw.stream()
    .map(t -> t.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))
    .toList();
Defensive patterns

Strategy: validation

Validate before calling

static boolean usesDatetimeFormat(String hql) {
    return hql.toLowerCase().matches("(?s).*format\\s*\\(.*(?i:yyyy|mm|dd).*\\).*");
}
if ( session.getJdbcServices().getDialect() instanceof MimerSQLDialect
        && usesDatetimeFormat(hql) ) {
    // select the raw timestamp instead and format with DateTimeFormatter in Java
}

Type guard

static boolean isMimer(Dialect d) { return d instanceof MimerSQLDialect; }

Try / catch

try {
    return session.createQuery(hql, String.class).getResultList();
} catch (UnsupportedOperationException e) {
    if ( String.valueOf(e.getMessage()).contains("format()") ) {
        // re-issue selecting raw timestamps and format client-side
    }
    throw e;
}

Prevention

When it happens

Trigger: Executing an HQL query that uses the format() datetime function on Mimer SQL, e.g. "select format(e.timestamp, 'yyyy-MM-dd') from Event e" or JPA criteria format expressions; any code path that needs to render a datetime format pattern in SQL for this dialect.

Common situations: Report queries that format dates in SQL being pointed at a Mimer test/dev database; shared projections that build formatted date columns; migrating display-oriented queries from MySQL/Oracle profiles.

Related errors


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