私のモデル:
@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;
}
私のコントローラー-アクション:
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();
}
}
フォームでWorkflowRole.idを文字列として渡そうとすると、次の例外が発生します。
@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
Play 1.2.5の汎用モデルのバインドで同様の問題が発生している人はいますか?