Search code examples
ibatismybatis

Mybatis to return a string not List of String


I have a straight forward query like,

Select emp_Name from Employee where empID=123 

How can i get the return as only String instead of List<String>, as here this query will return only one value.


Solution

  • Change return type of method in your mapper interface to String. This will return only value or null if there is no entry.