{"record":{"id":"a2d77d1185099f21","repo":"hibernate/hibernate-orm","slug":"lockmode-may-not-be-null","errorCode":null,"errorMessage":"LockMode may not be null","messagePattern":"LockMode may not be null","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/event/spi/RefreshEvent.java","lineNumber":50,"sourceCode":"\t);\n\n\tpublic RefreshEvent(@Nonnull Object object, @Nonnull EventSource source) {\n\t\tsuper(source);\n\t\tif (object == null) {\n\t\t\tthrow new IllegalArgumentException(\"Entity may not be null\");\n\t\t}\n\t\tthis.object = object;\n\t}\n\n\tpublic RefreshEvent(@Nullable String entityName, @Nonnull Object object, @Nonnull EventSource source){\n\t\tthis(object, source);\n\t\tthis.entityName = entityName;\n\t}\n\n\tpublic RefreshEvent(@Nonnull Object object, @Nonnull LockMode lockMode, @Nonnull EventSource source) {\n\t\tthis(object, source);\n\t\tif (lockMode == null) {\n\t\t\tthrow new IllegalArgumentException(\"LockMode may not be null\");\n\t\t}\n\t\tthis.lockOptions.setLockMode(lockMode);\n\t}\n\n\tpublic RefreshEvent(@Nonnull Object object, @Nonnull LockOptions lockOptions, @Nonnull EventSource source) {\n\t\tthis(object, source);\n\t\tif (lockOptions == null) {\n\t\t\tthrow new IllegalArgumentException(\"LockMode may not be null\");\n\t\t}\n\t\tthis.lockOptions = lockOptions;\n\t}\n\n\t/**\n\t * @deprecated use {@link #RefreshEvent(Object, LockOptions, EventSource)} instead.\n\t */\n\t@Deprecated(since = \"7.0\")\n\tpublic RefreshEvent(@Nullable String entityName, @Nonnull Object object, @Nonnull LockOptions lockOptions, @Nonnull EventSource source){\n\t\tthis(object,lockOptions,source);","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/event/spi/RefreshEvent.java#L32-L68","documentation":"Error \"LockMode may not be null\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Thrown when a caller passes a null LockMode to the API guarded in RefreshEvent.java:50.","commonSituations":"Typical situations: calling the method with an uninitialized variable; a lookup that returned null being passed straight through; missing null-checks in application code before invoking Hibernate.","solutions":["Pass a non-null LockMode to the refresh operation, or omit the lock-mode overload entirely."],"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"}