Error querying database. Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'user' in 'class learn.User'
### Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'user' in 'class learn.User'
主要原因是,复制代码的时候,入参那里将@Param注解去掉后,结果仍然使用 #{user.userCode}的方式获取值。
下面是正确的示例代码:
package learn;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.session.RowBounds;
import java.util.List;
public interface UserMapper {
public User selectUser(String id);
public User selectUserByIdAndName(String id,String name);
public User selectUserByArgs(String id,String name);
public User selectUserByIdFromTable(@Param("id")String id,@Param("tableName")String tableName);
public User selectUser2(