{"record":{"id":"5881a47ae76aa4f7","repo":"hibernate/hibernate-orm","slug":"entity-name-is-annotated-both-dynamicinsert","errorCode":null,"errorMessage":"Entity '<name>' is annotated both '@DynamicInsert' and '@SQLInsert'","messagePattern":"Entity '<name>' is annotated both '@DynamicInsert' and '@SQLInsert'","errorType":"exception","errorClass":"AnnotationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/internal/EntityBinder.java","lineNumber":1387,"sourceCode":"\t *\n\t * @return {@code true} if a property by that given name does already exist in the super hierarchy.\n\t */\n\tpublic boolean isPropertyDefinedInSuperHierarchy(String name) {\n\t\t// Yes, yes... persistentClass can be null because EntityBinder\n\t\t// can be used to bind Components (naturally!)\n\t\treturn persistentClass != null\n\t\t\t&& persistentClass.isPropertyDefinedInSuperHierarchy( name );\n\t}\n\n\tprivate void bindRowManagement() {\n\t\tfinal var modelsContext = modelsContext();\n\t\tfinal var dynamicInsert = annotatedClass.hasAnnotationUsage( DynamicInsert.class, modelsContext );\n\t\tfinal var dynamicUpdate = annotatedClass.hasAnnotationUsage( DynamicUpdate.class, modelsContext );\n\t\tpersistentClass.setDynamicInsert( dynamicInsert );\n\t\tpersistentClass.setDynamicUpdate( dynamicUpdate );\n\n\t\tif ( dynamicInsert && annotatedClass.hasAnnotationUsage( SQLInsert.class, modelsContext ) ) {\n\t\t\tthrow new AnnotationException( \"Entity '\" + name + \"' is annotated both '@DynamicInsert' and '@SQLInsert'\" );\n\t\t}\n\t\tif ( dynamicUpdate && annotatedClass.hasAnnotationUsage( SQLUpdate.class, modelsContext ) ) {\n\t\t\tthrow new AnnotationException( \"Entity '\" + name + \"' is annotated both '@DynamicUpdate' and '@SQLUpdate'\" );\n\t\t}\n\t}\n\n\tprivate void bindOptimisticLocking() {\n\t\tfinal var optimisticLocking = annotatedClass.getAnnotationUsage( OptimisticLocking.class, modelsContext() );\n\t\tpersistentClass.setOptimisticLockStyle( fromLockType( optimisticLocking == null\n\t\t\t\t? OptimisticLockType.VERSION\n\t\t\t\t: optimisticLocking.type() ) );\n\t}\n\n\tprivate void bindEntityAnnotation() {\n\t\tfinal var entity = annotatedClass.getAnnotationUsage( Entity.class, modelsContext() );\n\t\tif ( entity == null ) {\n\t\t\tthrow new AssertionFailure( \"@Entity should never be missing\" );\n\t\t}","sourceCodeStart":1369,"sourceCodeEnd":1405,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/internal/EntityBinder.java#L1369-L1405","documentation":"Error \"Entity '<name>' is annotated both '@DynamicInsert' and '@SQLInsert'\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Two mutually exclusive annotations are placed on the same property or class.","commonSituations":"Combining annotations Hibernate treats as alternatives (e.g. @DynamicInsert with @SQLInsert, @MapKey with @MapKeyColumn), often after copy-pasting mappings or upgrading versions.","solutions":["Keep only one of @DynamicInsert or @SQLInsert on the entity."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}