hibernate/hibernate-orm · error · UnsupportedOperationException

No create schema syntax supported by " + getClass().getName(

Error message

No create schema syntax supported by " + getClass().getName()

What it means

A SQL statement can carry a WITH clause whose CTEs are stored in a map keyed by the CTE table expression (label). addCteStatement uses putIfAbsent and throws IllegalArgumentException when a second CteStatement is registered under a label already present in this same container. It is a query-construction conflict - two different CTEs claiming the same name - not a runtime data problem; lookups through parentCteContainer mean shadowing across containers is allowed, but duplicates within one statement are not.

Source

Thrown at hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/AltibaseDialect.java:565

		builder.setAutoQuoteInitialUnderscore( false );
		builder.applyReservedWords( metadata );

		return super.buildIdentifierHelper( builder, metadata );
	}

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

	@Override
	public NameQualifierSupport getNameQualifierSupport() {
		return NameQualifierSupport.SCHEMA;
	}

	@Override
	public String[] getCreateSchemaCommand(String schemaName) {
		throw new UnsupportedOperationException( "No create schema syntax supported by " + getClass().getName() );
	}

	@Override
	public String[] getDropSchemaCommand(String schemaName) {
		throw new UnsupportedOperationException( "No drop schema syntax supported by " + getClass().getName() );
	}

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

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

	@Override

View on GitHub (pinned to fad1729dce)

Solutions

  1. Give one of the CTEs a unique name - e.g. change the @CTE entity name or the criteria CTE label - so labels no longer collide.
  2. If you control the code path, call getCteStatement(label) before addCteStatement and reuse the existing CTE instead of adding it again.
  3. Restructure the query so only one query part references the CTE, or attach it at a single (outer) container level.
  4. Check for accidental double registration in custom query translators or CTE-producing interceptors.

Example fix

// before: same @CTE entity pulled in by two query parts -> duplicate add
@CTE(name = "ids") public class IdsCte { ... }

// after: distinct names per CTE entity
@CTE(name = "mainIds") public class MainIdsCte { ... }
@CTE(name = "subIds")  public class SubIdsCte { ... }
Defensive patterns

Strategy: validation

Validate before calling

// If you build statements programmatically: check before adding a CTE
if ( statement.getCteStatement( cte.getCteTable().getTableExpression() ) != null ) {
    // reuse existing or pick a new label
} else {
    statement.addCteStatement( cte );
}

Try / catch

try {
    statement.addCteStatement( cte );
} catch ( IllegalArgumentException e ) {
    if ( e.getMessage() != null && e.getMessage().startsWith("A CTE with the label") ) {
        statement.addCteStatement( rename( cte, uniqueLabel() ) );
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: Registering two CteStatements with the same table expression on one statement: a @CTE-mapped entity used in two query parts that each add the CTE (e.g. union members both pulling in the entity CTE), a recursive CTE colliding with a regular CTE of the same name, or Criteria/extension code calling addCteStatement twice. Note getCteStatement consults the parent container, but the duplicate check only looks at the local map.

Common situations: Entity CTEs (org.hibernate.annotations.CTE) referenced from multiple subqueries or from both the main query and a secondary query in one flush batch; refactoring queries so the same CTE gets attached twice; migrations between Hibernate versions where nested CTE containers began sharing a parent.

Related errors


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