{"record":{"id":"160e195b15ba8b3c","repo":"hibernate/hibernate-orm","slug":"class-object-getclass-is-not-an-entity-class","errorCode":null,"errorMessage":"Class '{object.getClass()}' is not an entity class","messagePattern":"Class '(.+?)' is not an entity class","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java","lineNumber":1727,"sourceCode":"\t\t}\n\t\tcatch ( RuntimeException e ) {\n\t\t\tthrow getExceptionConverter().convert( e );\n\t\t}\n\t}\n\n\tprivate void assertInstanceOfEntityType(Object object) {\n\t\ttry {\n\t\t\tfinal String entityName = getEntityNameResolver().resolveEntityName( object );\n\t\t\tif ( entityName == null ) {\n\t\t\t\tthrow new IllegalArgumentException( \"Could not resolve entity name for class '\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t+ object.getClass() + \"'\" );\n\t\t\t}\n\t\t\telse {\n\t\t\t\trequireEntityPersister( entityName );\n\t\t\t}\n\t\t}\n\t\tcatch ( HibernateException e ) {\n\t\t\tthrow new IllegalArgumentException( \"Class '\" + object.getClass()\n\t\t\t\t\t\t\t\t\t\t\t\t+ \"' is not an entity class\", e );\n\t\t}\n\t}\n\n\t@Override\n\t@Deprecated(forRemoval = true)\n\t@SuppressWarnings(\"removal\")\n\tpublic boolean contains(@Nonnull String entityName, @Nonnull Object object) {\n\t\treturn contains( object );\n\t}\n\n\t@Override\n\t@Nonnull\n\tpublic ProcedureCall createStoredProcedureCall(@Nonnull String procedureName) {\n\t\tcheckOpen();\n//\t\tcheckTransactionSynchStatus();\n\t\treturn super.createStoredProcedureCall( procedureName );\n\t}","sourceCodeStart":1709,"sourceCodeEnd":1745,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java#L1709-L1745","documentation":"Error \"Class '{object.getClass()}' is not an entity class\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Thrown at hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java:1727 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Mark the class as an entity (@Entity or XML mapping) and ensure it is scanned/registered with the SessionFactory before use.","Pass an actual entity class or instance rather than a DTO, proxy base, or unmapped class."],"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"}