Hibernate报错:org.hibernate.ObjectNotFoundException: No row with the given identifier exists 解决办法

本文探讨了在使用Hibernate框架时遇到的ObjectNotFoundException,详细分析了错误信息'Norowwiththegivenidentifierexists',并提供了针对findFirstAcquirableJob查询失败的解决方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

报错信息

org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [org.jbpm.pvm.internal.model.ExecutionImpl#78781405]
	at org.hibernate.impl.SessionFactoryImpl$2.handleEntityNotFound(SessionFactoryImpl.java:419)
	at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:171)
	at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:223)
	at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:126)
	at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:906)
	at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:874)
	at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:590)
	at org.hibernate.type.EntityType.resolve(EntityType.java:412)
	at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:139)
	at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:877)
	at org.hibernate.loader.Loader.doQuery(Loader.java:752)
	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
	at org.hibernate.loader.Loader.doList(Loader.java:2232)
	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2129)
	at org.hibernate.loader.Loader.list(Loader.java:2124)
	at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401)
	at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363)
	at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
	at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1149)
	at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
	at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:835)
	at org.jbpm.pvm.internal.hibernate.DbSessionImpl.findFirstAcquirableJob(DbSessionImpl.java:444)
	at org.jbpm.pvm.internal.jobexecutor.AcquireJobsCmd.execute(AcquireJobsCmd.java:51)
	at org.jbpm.pvm.internal.jobexecutor.AcquireJobsCmd.execute(AcquireJobsCmd.java:29)
	at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
	at org.jbpm.pvm.internal.tx.SpringCommandCallback.doInTransaction(SpringCommandCallback.java:45)
	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
	at org.jbpm.pvm.internal.tx.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:49)
	at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:58)
	at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:43)
	at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:56)
	at org.jbpm.pvm.internal.jobexecutor.DispatcherThread.acquireJobs(DispatcherThread.java:210)
	at org.jbpm.pvm.internal.jobexecutor.DispatcherThread.run(DispatcherThread.java:114)
09:13:00,181  WARN DbSessionImpl:90 - Query SQL 'findFirstAcquirableJob' encounter some problem:

原因和解决方案

  1. 原因及其解决方案
    Hibernate报错:org.hibernate.ObjectNotFoundException: No row with the given identifier exists 解决办法
  2. 补充
    在报错信息的最后一行可以确认报错的sql语句是findFirstAcquirableJob
2025-08-14 09:55:57.343 -ERROR 17 --- [nio-9130-exec-4] c.c.t.i.c.AbstractCustomExceptionHandler@printExceptionStack: [[L4Fg]] [http-nio-9130-exec-4] cn.com.truthvision.iacp.pojo.exception.ObjectNotFoundException: county[110105] not found [L4Fg] cn.com.truthvision.iacp.pojo.exception.ObjectNotFoundException: county[110105] not found [L4Fg] at cn.com.truthvision.iacp.biz.smartpark.service.service.AdministrativeDivisionService.lambda$queryCounty$16(AdministrativeDivisionService.java:226) [L4Fg] at java.base/java.util.Optional.orElseThrow(Optional.java:403) [L4Fg] at cn.com.truthvision.iacp.biz.smartpark.service.service.AdministrativeDivisionService.queryCounty(AdministrativeDivisionService.java:225) [L4Fg] at cn.com.truthvision.iacp.biz.smartpark.service.controller.AdministrativeDivisionController.lambda$queryCounty$3(AdministrativeDivisionController.java:91) [L4Fg] at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) [L4Fg] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) [L4Fg] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) [L4Fg] at java.base/java.lang.Thread.run(Thread.java:1583) 2025-08-14 09:55:57.344 - INFO 17 --- [nio-9130-exec-4] c.c.t.i.b.s.s.c.ResponseBodyPrinter @beforeBodyWrite: request method[GET] uri[http://100.67.190.21:9130/smart-park-service/administrative-division/country?callerUid=60271788-0021-0000-0000-000000000000&countyCode=110105] body[] response body[{"code":404000004,"message":"county[110105] not found"}] 2025-08-14 09:56:03.606 -DEBUG 17 --- [ scheduling-1] c.c.t.i.b.s.service.service.TaskService @scheduleTask: scheduleTask: runningTask(0) 2025-08-14 09:56:03.609 - INFO 17 --- [ scheduling-1] p6spy @logSQL: time: 0 ms | statement-0 | sql: SELECT 1 2025-08-14 09:56:03.612 - INFO 17 --- [ scheduling-1] p6spy @logSQL: time: 0 ms | statement-0 | sql: /* select generatedAlias0 from TaskProgressPO as generatedAlias0 where ( generatedAlias0.status in (:param0) ) and ( generatedAlias0.lastUpdate<:param1 ) */ select taskprogre0_."task_id" as task_id1_29_, taskprogre0_."code" as code2_29_, taskprogre0_."complete_time" as complete3_29_, taskprogre0_."ex_msg" as ex_msg4_29_, taskprogre0_."last_update" as last_upd5_29_, taskprogre0_."progress" as progress6_29_, taskprogre0_."result" as result7_29_, taskprogre0_."start_time" as start_ti8_29_, taskprogre0_."status" as status9_29_ from t_task_progress taskprogre0_ where (taskprogre0_."status" in ('created' , 'running')) and taskprogre0_."last_update"<'2025-08-14T09:55:33.606+0800' limit 1 2025-08-14 09:56:03.612 -DEBUG 17 --- [ scheduling-1] c.c.t.i.b.s.service.service.TaskService @scheduleTask: scheduleTask: found task(0) 2025-08-14 09:56:03.639 -DEBUG 17 --- [ scheduling-1] c.c.t.i.b.s.s.service.ImportTaskService @scheduleTask: scheduleTask: runningTask(0) 2025-08-14 09:56:03.643 -DEBUG 17 --- [ scheduling-1] .t.i.b.s.s.s.ImportProprietorTaskService@scheduleTask: scheduleTask: runningTask(0) 详细解释日志,并分析问题原因
最新发布
08-15
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值