Note that there are some explanatory texts on larger screens.

plurals
  1. POplay framework 1.2.5 binding a model (GenericModel) exception (numberformatexception)
    primarykey
    data
    text
    <p><strong>My Model</strong>:</p> <pre><code>@Entity(name = "WORKFLOW_ROLE") public class WorkflowRole extends GenericModel { @Id @Column(name = "IDNR", unique = true, nullable = false, precision = 22, scale = 0) @Required @Min(0) public long id; } </code></pre> <p><strong>My Controller-Action</strong>:</p> <pre><code>public static void postNewRole(@Valid models.WorkflowRole role) { try { role.workflow = models.Workflow.findById(role.workflow.id); if (validation.hasErrors()) { params.flash(); // add http parameters to the flash scope validation.keep(); // keep the errors for the next request newRole(); } role.create(); flash.success("Rolle erstellt"); index(); } catch (Exception e) { params.flash(); validation.keep(); flash.put("error", e.getMessage()); newRole(); } } </code></pre> <h2>Now i get follwowing exception if i try to pass the <em>WorkflowRole.id</em> as a String in my form:</h2> <pre><code>@6chopgia8 Internal Server Error (500) for request POST /workflowrole/postnewrole Oops: UnexpectedException An unexpected error occured caused by exception UnexpectedException: Unexpected Error play.exceptions.UnexpectedException: Unexpected Error at play.data.validation.ValidationPlugin.beforeActionInvocation(ValidationPlugin.java:80) at play.plugins.PluginCollection.beforeActionInvocation(PluginCollection.java:639) at play.mvc.ActionInvoker.invoke(ActionInvoker.java:134) at Invocation.HTTP Request(Play!) Caused by: play.exceptions.UnexpectedException: Unexpected Error at play.db.jpa.JPAPlugin.bind(JPAPlugin.java:84) at play.plugins.PluginCollection.bind(PluginCollection.java:579) at play.data.binding.Binder.bind(Binder.java:112) at play.mvc.ActionInvoker.getActionMethodArgs(ActionInvoker.java:651) at play.data.validation.ValidationPlugin$Validator.validateAction(ValidationPlugin.java:117) at play.data.validation.ValidationPlugin.beforeActionInvocation(ValidationPlugin.java:72) ... 3 more Caused by: java.lang.NumberFormatException: For input string: "sdf" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48) at java.lang.Long.parseLong(Long.java:410) at java.lang.Long.parseLong(Long.java:468) at play.data.binding.Binder.internalDirectBind(Binder.java:612) at play.data.binding.Binder.directBind(Binder.java:529) at play.db.jpa.JPAPlugin.bind(JPAPlugin.java:76) ... 8 more </code></pre> <p>Is anybody experiencing similar problems with the binding of generic models in play 1.2.5?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload