{"record":{"id":"6981d8d4e34db52f","repo":"hibernate/hibernate-orm","slug":"no-active-transaction-6981d8","errorCode":null,"errorMessage":"No active transaction","messagePattern":"No active transaction","errorType":"exception","errorClass":"TransactionRequiredException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java","lineNumber":2604,"sourceCode":"\n\t@Override\n\tpublic void detach(@Nonnull Object entity) {\n\t\tcheckOpen();\n\t\ttry {\n\t\t\tevict( entity );\n\t\t}\n\t\tcatch (RuntimeException e) {\n\t\t\tthrow getExceptionConverter().convert( e );\n\t\t}\n\t}\n\n\t@Override\n\t@Nonnull\n\tpublic LockModeType getLockMode(@Nonnull Object entity) {\n\t\tcheckOpen();\n\n\t\tif ( !isTransactionInProgress() ) {\n\t\t\tthrow new TransactionRequiredException( \"No active transaction\" );\n\t\t}\n\n\t\t//noinspection ConstantValue\n\t\tif ( entity == null ) {\n\t\t\tthrow new IllegalArgumentException( \"Entity may not be null\" );\n\t\t}\n\t\tif ( !contains( entity ) ) {\n\t\t\t// convert() calls markForRollbackOnly()\n\t\t\tconvertIfJpaBootstrap(\n\t\t\t\t\tnew UnmanagedObjectException( \"Given entity is not associated with the persistence context\" ),\n\t\t\t\t\tnull\n\t\t\t);\n\t\t}\n\n\t\treturn LockModeTypeHelper.getLockModeType( getCurrentLockMode( entity ) );\n\n\t}\n","sourceCodeStart":2586,"sourceCodeEnd":2622,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java#L2586-L2622","documentation":"Error \"No active transaction\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Thrown at hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java:2604 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Begin a transaction (session.beginTransaction() or @Transactional) before calling the operation that requires one.","Check session.getTransaction().isActive() and start the transaction if needed."],"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"}