Error while binding form request play-framework 2.5.4
<p>I am using play-framework-java 2.5.4.</p>

<p><strong>I want to bind a user-input-from values to my model class variables.</strong></p>

<p>This is my controller function that except form <strong>POST</strong> : </p>

<pre><code>public Result formSubmit()
    {
        MlmModel mlmModel;
        play.data.Form&lt;MlmModel&gt; form = play.data.Form.form(MlmModel.class).bindFromRequest();
        mlmModel = form.get();
        mlmModel.save();
        mlmModel.callUpdate();
        return ok(Json.toJson(mlmModel));
    }
</code></pre>

<p>But I am <strong>getting this error</strong>  </p>

<pre><code>[CompletionException: java.lang.IllegalStateException: Error(s) binding form: {"parent_id":["Invalid value"]}]
</code></pre>

<p><strong>because, one of my input field is not compulsory to fill by user.</strong></p>

<p>It's fine if user left blank some fields.</p>

<p>But my code should </p>

<ul>
<li>save all data that user provides to database and  </li>
<li>should save <strong>0</strong> by default for the fields    left blank by user .</li>
</ul>

<p>I am Using <strong>play-Eben</strong> and my database server is MySQL 5.x</p>

<p>How can I achieve this?</p>

<p>Edit 1 :</p>

<p>MlmModel.java</p>

<pre><code>@Entity
public class MlmModel extends Model
{
    @Id
    @GeneratedValue()
    public Long ID;
    public Logic logic;
    public MlmModel() {
        this.parent_id = 0;
        logic = new Logic(this);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String name;


    public long getParent_id() {
        return parent_id;
    }

    public void setParent_id(long parent_id) {
        if (String.valueOf(parent_id).isEmpty())
            this.parent_id = 0;
        this.parent_id = parent_id;
    }
    @Column(columnDefinition = "long default 0")
    public long parent_id;

    @Formats.DateTime(pattern="dd/MM/yyyy")
    public Date created_time = new Date();

    public Long balance = new Long(0);

    public static Finder&lt;Long, MlmModel&gt; find = new Finder&lt;Long,MlmModel&gt;(MlmModel.class);



    public List&lt;ValidationError&gt; validate()
    {
        List&lt;ValidationError&gt; errors = new ArrayList&lt;ValidationError&gt;();
        if (Long.toString(parent_id).isEmpty())
            parent_id = 0;
        if (errors.isEmpty())
            return null;
        else
            return errors;
    }
}
</code></pre>