{"record":{"id":"950a2f3f244307fc","repo":"hibernate/hibernate-orm","slug":"jdbc-parameter-value-not-bound-s-950a2f","errorCode":null,"errorMessage":"JDBC parameter value not bound - %s","messagePattern":"JDBC parameter value not bound - (.+?)","errorType":"exception","errorClass":"ExecutionException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/sql/exec/internal/TemporalJdbcParameter.java","lineNumber":36,"sourceCode":" *\n * @author Gavin King\n */\npublic class TemporalJdbcParameter extends SqlTypedMappingJdbcParameter {\n\n\tpublic TemporalJdbcParameter(SqlTypedMapping sqlTypedMapping) {\n\t\tsuper( sqlTypedMapping );\n\t}\n\n\t@Override\n\tpublic void bindParameterValue(PreparedStatement statement, int startPosition, JdbcParameterBindings jdbcParamBindings, ExecutionContext executionContext)\n\t\t\tthrows SQLException {\n\t\tfinal SharedSessionContractImplementor session = executionContext.getSession();\n\t\tfinal Object temporalIdentifier = session.getLoadQueryInfluencers().getTemporalIdentifier();\n\t\tfinal Object currentChangesetIdentifier = temporalIdentifier != null\n\t\t\t\t? temporalIdentifier\n\t\t\t\t: session.getCurrentChangesetIdentifier();\n\t\tif ( currentChangesetIdentifier == null ) {\n\t\t\tthrow new ExecutionException( \"JDBC parameter value not bound - \" + this );\n\t\t}\n\t\tfinal Object bindValue = getJdbcMapping().convertToRelationalValue( currentChangesetIdentifier );\n\t\tbindParameterValue( getJdbcMapping(), statement, bindValue, startPosition, executionContext );\n\t}\n}\n","sourceCodeStart":18,"sourceCodeEnd":42,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/sql/exec/internal/TemporalJdbcParameter.java#L18-L42","documentation":"This Hibernate build adds temporal (changeset-based) filtering: TemporalJdbcParameter binds the current changeset identifier as the JDBC parameter for temporal restrictions. The value comes from the session's LoadQueryInfluencers temporal identifier, falling back to the session's current changeset identifier. If both are null the parameter cannot be bound and bindParameterValue throws ExecutionException('JDBC parameter value not bound - ...TemporalJdbcParameter...').","triggerScenarios":"Executing a query with a temporal restriction on a session that has neither an explicit temporal identifier (LoadQueryInfluencers.setTemporalIdentifier(...)) nor a current changeset identifier (the session is not inside an audited write context that established one).","commonSituations":"Enabling temporal/audit query mode without configuring the changeset id; running temporal queries against a stateless session opened without temporal options; code paths that clear or never set the temporal context; mixing audit loaders with ordinary sessions.","solutions":["Set the temporal context before running the query: session.getLoadQueryInfluencers().setTemporalIdentifier(changesetId), or pass the temporal identifier through the session options","Run the query inside the write transaction context that defines a current changeset identifier","Disable temporal filtering for that query/session if temporal semantics are not intended","Verify audit configuration: temporal restrictions must always be evaluated against a concrete changeset"],"exampleFix":"// before\nList<Entity> rows = session.createQuery(...).list(); // temporal restriction, no changeset id -> throws\n\n// after\nsession.getLoadQueryInfluencers().setTemporalIdentifier( AuditLog.ALL_CHANGESETS );\nList<Entity> rows = session.createQuery(...).list();","handlingStrategy":"validation","validationCode":"Object temporalId = session.getLoadQueryInfluencers().getTemporalIdentifier();\nif ( temporalId == null && session.getCurrentChangesetIdentifier() == null ) {\n    throw new IllegalStateException( \"Set a temporal identifier before running temporal queries\" );\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always establish the temporal context (influencers.setTemporalIdentifier or an audited write session) before executing temporal queries","Pass temporal identifiers through session options when opening stateless sessions","Centralize temporal-query execution in one helper that asserts the changeset context first"],"tags":["hibernate","orm","temporal","audit","parameter-binding"],"backgroundTag":"temporal-context-missing","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}