{"record":{"id":"4d63aca6ce384275","repo":"hibernate/hibernate-orm","slug":"no-entry-for-collection","errorCode":null,"errorMessage":"no entry for collection","messagePattern":"no entry for collection","errorType":"exception","errorClass":"HibernateException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/internal/StatelessSessionImpl.java","lineNumber":1376,"sourceCode":"\t\t}\n\t}\n\n\t@Override\n\tpublic Object immediateLoad(@Nonnull String entityName, @Nonnull Object id) {\n\t\tif ( getPersistenceContextInternal().isLoadFinished() ) {\n\t\t\tthrow new SessionException( \"proxies cannot be fetched by a stateless session\" );\n\t\t}\n\t\t// unless we are still in the process of handling a top-level load\n\t\treturn get( entityName, id );\n\t}\n\n\t@Override\n\tpublic void initializeCollection(@Nonnull PersistentCollection<?> collection, boolean writing) {\n\t\tcheckOpen();\n\t\tfinal var persistenceContext = getPersistenceContextInternal();\n\t\tfinal var ce = persistenceContext.getCollectionEntry( collection );\n\t\tif ( ce == null ) {\n\t\t\tthrow new HibernateException( \"no entry for collection\" );\n\t\t}\n\t\tif ( !collection.wasInitialized() ) {\n\t\t\tfinal var loadedPersister = ce.getLoadedPersister();\n\t\t\tfinal Object loadedKey = ce.getLoadedKey();\n\t\t\tif ( loadedPersister == null ) {\n\t\t\t\tthrow new AssertionFailure( \"collection entry has no loaded persister\" );\n\t\t\t}\n\t\t\tif ( loadedKey == null ) {\n\t\t\t\tthrow new AssertionFailure( \"collection entry has no loaded key\" );\n\t\t\t}\n\t\t\tif ( SESSION_LOGGER.isTraceEnabled() ) {\n\t\t\t\tSESSION_LOGGER.initializingCollection(\n\t\t\t\t\t\tcollectionInfoString( loadedPersister, collection, loadedKey, this ) );\n\t\t\t}\n\t\t\tfinal boolean foundInCache =\n\t\t\t\t\tinitializeCollectionFromCache( loadedKey, loadedPersister, collection, this );\n\t\t\tif ( foundInCache ) {\n\t\t\t\tSESSION_LOGGER.collectionInitializedFromCache();","sourceCodeStart":1358,"sourceCodeEnd":1394,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/internal/StatelessSessionImpl.java#L1358-L1394","documentation":"Error \"no entry for collection\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Thrown at hibernate-core/src/main/java/org/hibernate/internal/StatelessSessionImpl.java:1376 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the collection is initialized/loaded before accessing it in a stateless session context; stateless sessions do not track collection entries.","Fetch the collection explicitly (join fetch or separate query)."],"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"}