[1.2] How to debug: "id to load is required for loading"

6,013 views
Skip to first unread message

Martin Grotzke

unread,
Jan 31, 2012, 10:35:35 AM1/31/12
to play-fr...@googlegroups.com
Hi all,

I modified the "Post" class from the tutorial according to my needs
(renamed to Query and changed fields). I also changed the related
controllers, templates and css files accordingly.

Still one thing seems to be missing, as now when listing the items (now
GET /queries/list), there's an "IllegalArgumentException: id to load is
required for loading" (in Application.show, which invokes
`Query.findById(id);`).

Now I wonder where the id got lost. I changed the (as part of the
tutorial customized) templates which didn't changed anything. So I
wonder which template is causing this issue.

What's the best way to debug this in play?


I'm using play 1.2.4.

The stack trace:

Internal Server Error (500) for request GET /queries/list

Execution exception (In /app/controllers/Application.java around line 28)
IllegalArgumentException occured : id to load is required for loading

play.exceptions.JavaExecutionException: id to load is required for loading
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:231)
at Invocation.HTTP Request(Play!)
Caused by: java.lang.IllegalArgumentException: id to load is required
for loading
at org.hibernate.event.LoadEvent.<init>(LoadEvent.java:89)
at org.hibernate.event.LoadEvent.<init>(LoadEvent.java:61)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:1002)
at org.hibernate.impl.SessionImpl.get(SessionImpl.java:998)
at
org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:614)
at
org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:589)
at play.db.jpa.JPQL.findById(JPQL.java:36)
at models.Query.findById(Query.java)
at controllers.Application.show(Application.java:28)
at
play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:548)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:502)
at
play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:478)
at
play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:473)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:161)


Do you need more information?

Thanx && cheers,
Martin

signature.asc

Martin Grotzke

unread,
Jan 31, 2012, 2:59:00 PM1/31/12
to play-fr...@googlegroups.com
Hi,

I just want to let you know that I found the issue:

The link (in navigation of the admin template) to the queries list (<a
href="@{Queries.list()}">Queries</a>) was resolved to
href="/queries/list" instead of href="/admin/queries". As a result
/queries/list matched the route
GET /queries/{id} Application.show
and the "list" part was just dropped as it could not be converted (the
dropped as not converted part is what I'm assuming).

When I add @CRUD.For(Query.class) to the Queries controller the link is
correctly resolved to /admin/queries (so that Queries.list is called
instead Application.show) and the list of queries is displayed correctly.

Cheers,
Martin

signature.asc
Reply all
Reply to author
Forward
0 new messages