How to check if database table is empty in java play framework
<p>I'm able to retrieve data from database but not to add condition which will display an alert when database table is empty.</p>

<p>Here is my code:</p>

<h3><code>index.scala.html</code>:</h3>

<pre><code>@(formList: List[Users],form: Form[Users])

@main("history") {

    @for(i &lt;- Users.all()) {

        @if(i.client.equalsIgnoreCase("potato")) {

            &lt;Table&gt;
                &lt;tbody&gt;
                    &lt;tr&gt;
                        &lt;td&gt;&lt;a href="/#"&gt;&lt;i &gt;@i.firstname @i.lastname &lt;/i&gt;&lt;/a&gt;&lt;/td&gt;
                        &lt;td&gt;&lt;a href="/#"&gt;&lt;i&gt;@i.phonenumber&lt;/i&gt;&lt;/a&gt;&lt;/td&gt;
                        &lt;td&gt;&lt;a href="/#"&gt;&lt;i&gt;@i.amount&lt;/i&gt;&lt;/a&gt;&lt;/td&gt;
                        &lt;td&gt;&lt;a href="/#"&gt;&lt;i&gt;@i.doneAt&lt;/i&gt;&lt;/a&gt;&lt;/td&gt;
                        &lt;td&gt;&lt;a href="@routes.Application.edit(i.id)"&gt;&lt;i&gt;&lt;span class="glyphicon glyphicon-pencil "&gt;&lt;/span&gt;&lt;/i&gt;&lt;/a&gt;&lt;/td&gt;
                        &lt;td&gt;&lt;a href="@routes.Application.delete(i.id) "&gt;&lt;i&gt;&lt;span class="glyphicon glyphicon-trash "&gt;&lt;/span&gt;&lt;/i&gt;&lt;/a&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                &lt;/tbody&gt;
            &lt;/table&gt;
        }
    }
}
</code></pre>

<h3>Controller method:</h3>

<pre><code>public static Result history(long id) {
    Form&lt;Users&gt; taskData = form(Users.class);
    return ok(history.render(Users.all(), taskData));
}
</code></pre>