{"record":{"id":"f37aa55fbde3b098","repo":"hibernate/hibernate-orm","slug":"no-create-schema-syntax-supported-by-getclass","errorCode":null,"errorMessage":"No create schema syntax supported by \" + getClass().getName()","messagePattern":"No create schema syntax supported by \" \\+ getClass\\(\\)\\.getName\\(\\)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/AltibaseDialect.java","lineNumber":565,"sourceCode":"\t\tbuilder.setAutoQuoteInitialUnderscore( false );\n\t\tbuilder.applyReservedWords( metadata );\n\n\t\treturn super.buildIdentifierHelper( builder, metadata );\n\t}\n\n\t@Override\n\tpublic boolean canCreateSchema() {\n\t\treturn false;\n\t}\n\n\t@Override\n\tpublic NameQualifierSupport getNameQualifierSupport() {\n\t\treturn NameQualifierSupport.SCHEMA;\n\t}\n\n\t@Override\n\tpublic String[] getCreateSchemaCommand(String schemaName) {\n\t\tthrow new UnsupportedOperationException( \"No create schema syntax supported by \" + getClass().getName() );\n\t}\n\n\t@Override\n\tpublic String[] getDropSchemaCommand(String schemaName) {\n\t\tthrow new UnsupportedOperationException( \"No drop schema syntax supported by \" + getClass().getName() );\n\t}\n\n\t@Override\n\tpublic boolean qualifyIndexName() {\n\t\treturn false;\n\t}\n\n\t@Override\n\tpublic boolean supportsTruncateWithCast(){\n\t\treturn false;\n\t}\n\n\t@Override","sourceCodeStart":547,"sourceCodeEnd":583,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/AltibaseDialect.java#L547-L583","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","If you control the code path, call getCteStatement(label) before addCteStatement and reuse the existing CTE instead of adding it again.","Restructure the query so only one query part references the CTE, or attach it at a single (outer) container level.","Check for accidental double registration in custom query translators or CTE-producing interceptors."],"exampleFix":"// before: same @CTE entity pulled in by two query parts -> duplicate add\n@CTE(name = \"ids\") public class IdsCte { ... }\n\n// after: distinct names per CTE entity\n@CTE(name = \"mainIds\") public class MainIdsCte { ... }\n@CTE(name = \"subIds\")  public class SubIdsCte { ... }","handlingStrategy":"validation","validationCode":"// If you build statements programmatically: check before adding a CTE\nif ( statement.getCteStatement( cte.getCteTable().getTableExpression() ) != null ) {\n    // reuse existing or pick a new label\n} else {\n    statement.addCteStatement( cte );\n}","typeGuard":null,"tryCatchPattern":"try {\n    statement.addCteStatement( cte );\n} catch ( IllegalArgumentException e ) {\n    if ( e.getMessage() != null && e.getMessage().startsWith(\"A CTE with the label\") ) {\n        statement.addCteStatement( rename( cte, uniqueLabel() ) );\n    } else {\n        throw e;\n    }\n}","preventionTips":["Give every @CTE entity a globally distinct name; avoid two query parts attaching the same CTE entity independently.","When composing CTEs programmatically, always consult getCteStatement(label) first and reuse.","Keep CTE labels in integration tests asserting uniqueness per statement."],"tags":["cte","duplicate","sql","query-construction"],"backgroundTag":"duplicate-cte-name","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}