Skip to content

JPAQuery.first() raised NoResultException when no result found #6

Description

@greenlaw110

When using JPAQuery.first() in the case where no result in the database matches the query criteria, it will raise an exception javax.persistence.NoResultException, here is the error stack trace:

javax.persistence.NoResultException: No entity found for query
	at org.hibernate.jpa.internal.QueryImpl.getSingleResult(QueryImpl.java:532)
	at act.db.jpa.JPAQuery.first(JPAQuery.java:141)
	at com.wykj.mcs.controllers.Application.test(Application.java:64)
	at com.wykj.mcs.controllers.ApplicationMethodAccess.invoke(Unknown Source)
	at act.handler.builtin.controller.impl.ReflectedHandlerInvoker.invoke(ReflectedHandlerInvoker.java:815)
	at act.handler.builtin.controller.impl.ReflectedHandlerInvoker.handle(ReflectedHandlerInvoker.java:480)
	at act.handler.builtin.controller.ControllerAction.handle(ControllerAction.java:48)
	at act.handler.builtin.controller.RequestHandlerProxy._handle(RequestHandlerProxy.java:517)
	at act.handler.builtin.controller.RequestHandlerProxy.handle(RequestHandlerProxy.java:203)
	at act.app.ActionContext.proceedWithHandler(ActionContext.java:1050)
	at act.route.Router$ContextualHandler.handle(Router.java:1596)
	at act.xio.NetworkHandler$3.run(NetworkHandler.java:159)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions