The reason for this error is that the sql
statement did not query the data, and the return was `null`. And the dao
layer method we defined returns as int
, and the following prompt will appear:
return null from a method with a primitive return type (int). (Trying to return null from a method with a primitive return type (int))
Ingeter
is a wrapper class of int
, the initial value of int
is 0
, and the initial value of Ingeter
is null
.
Change the return type of the dao
layer to Integer
.