{"record":{"id":"915519d6491fc9c5","repo":"hibernate/hibernate-orm","slug":"entity-name-is-annotated-both-dynamicupdate","errorCode":null,"errorMessage":"Entity '${name}' is annotated both '@DynamicUpdate' and '@SQLUpdate'","messagePattern":"Entity '(.+?)' is annotated both '@DynamicUpdate' and '@SQLUpdate'","errorType":"exception","errorClass":"AnnotationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/internal/EntityBinder.java","lineNumber":1390,"sourceCode":"\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}\n\t\tfinal String entityName = entity.name();\n\t\tif ( StringHelper.isQuoted( entityName ) ) {\n\t\t\tthrow new AnnotationException(","sourceCodeStart":1372,"sourceCodeEnd":1408,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/internal/EntityBinder.java#L1372-L1408","documentation":"Error \"Entity '${name}' is annotated both '@DynamicUpdate' and '@SQLUpdate'\" 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 @DynamicUpdate or @SQLUpdate 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"}