2017-08-16 193 views
0

我开始使用的MyBatis有注释,我试图在这样的映射器通过一个完整的查询:传递一个完整的SQL查询作为参数传入一个映射器中的MyBatis

public interface Mapper { 

    @Select("#{sql}") 
    public HashMap<String,String> getResult(String sql);  

} 

这是怎么了我调用方法:

String sql = "select * from table"; 
List<Object> list = session.selectList("getResult",sql); 

当我执行我得到这个例外的程序:

org.apache.ibatis.exceptions.PersistenceException: 
Error querying database. Cause: org.apache.ibatis.type.TypeException: Error setting null for parameter #1 with JdbcType OTHER . Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property. Cause: java.sql.SQLException: Invalid column type: 1111 
+0

每个现代框架的主要目标是阻止sql注入。我会非常惊讶,如果Yoy将有效果 –

回答