aop.AopInvocationException: Null return value from
<p>here is the repository:</p>

<pre><code>@Query(value = "select u.balance from User u where u.name=:name")
float toGetBalance(@Param("name") String name);
</code></pre>

<p>and here is the DAO interface:</p>

<pre><code>boolean checkBalance(String userName, float totalPrice);
</code></pre>

<p>and here is the service</p>

<pre><code>@Transactional(readOnly = true)
@Override
public boolean checkBalance(String userName, float totalPrice) {

    if (userRepository.toGetBalance(userName) &lt; totalPrice) {

        return false;

    } else {

        return true;

    }

}
</code></pre>

<p>and here is the error info:</p>

<pre><code>org.springframework.aop.AopInvocationException: Null return value from advice does not match primitive return type for: public abstract float com.repository.UserRepository.toGetBalance(java.lang.String)
</code></pre>

<p>and the type of balance is float!</p>

<p>what's wrong?</p>