{"record":{"id":"90804882a9fe44ad","repo":"hibernate/hibernate-orm","slug":"passed-properties-contained-both-a-load-and-a-fetc-908048","errorCode":null,"errorMessage":"Passed properties contained both a LOAD and a FETCH graph which is illegal - only one should be passed","messagePattern":"Passed properties contained both a LOAD and a FETCH graph which is illegal - only one should be passed","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java","lineNumber":2231,"sourceCode":"\t\tfinal var options = determineFindOptions( lockMode, properties );\n\t\tfinal var entityDescriptor = requireEntityPersisterForLoad( entityClass );\n\t\treturn byKeyWithGraph( entityClass, entityDescriptor, properties, options )\n\t\t\t\t.performFind( primaryKey );\n\t}\n\n\tprivate <T> FindByKeyOperation<T> byKeyWithGraph(\n\t\t\tClass<T> entityClass,\n\t\t\tEntityPersister entityDescriptor,\n\t\t\tMap<String, Object> properties,\n\t\t\tFindOption[] options) {\n\t\tfinal var fetchHint = fetchGraphFromHints( properties );\n\t\tfinal var loadHint = loadGraphFromHints( properties );\n\t\tfinal GraphSemantic graphSemantic;\n\t\tfinal RootGraphImplementor<?> graph;\n\t\tif ( fetchHint != null ) {\n\t\t\tif ( loadHint != null ) {\n\t\t\t\t// can't have both\n\t\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\t\"Passed properties contained both a LOAD and a FETCH graph which is illegal - \" +\n\t\t\t\t\t\t\"only one should be passed\"\n\t\t\t\t);\n\t\t\t}\n\t\t\tgraphSemantic = GraphSemantic.FETCH;\n\t\t\tgraph = fetchHint;\n\t\t}\n\t\telse if ( loadHint != null ) {\n\t\t\tgraphSemantic = GraphSemantic.LOAD;\n\t\t\tgraph = loadHint;\n\t\t}\n\t\telse {\n\t\t\tgraphSemantic = null;\n\t\t\tgraph = null;\n\t\t}\n\t\tif ( graph != null && graph.getGraphedType().getJavaType() != entityClass ) {\n\t\t\tthrow new IllegalArgumentException( \"Fetch graph has wrong root type\" );\n\t\t}","sourceCodeStart":2213,"sourceCodeEnd":2249,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java#L2213-L2249","documentation":"Error \"Passed properties contained both a LOAD and a FETCH graph which is illegal - only one should be passed\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Thrown at hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java:2231 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass either a jakarta.persistence.loadgraph or a fetchgraph hint, not both, when calling find()/query hints.","Remove one of the two graph hints from the properties map."],"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"}