我有这个:
public interface PermessiMapper {
final String SELECT_PERMESSI = "SELECT PR.CODICE as CODICE, PR.DESCRIZIONE as DESCRIZIONE FROM PERMISSION PR INNER JOIN USER_PERMISSION UP ON PR.CODICE=UP.PERMESSO INNER JOIN USERS US ON US.NOME_UTENTE=UP.UTENTE WHERE US.NOME_UTENTE = #{user} AND US.PASSWORD = #{password}";
@Select(SELECT_PERMESSI)
@Results(value = {
@Result(property="codice", column="CODICE" ),
@Result(property="descrizione", column="DESCRIZIONE")})
public ArrayList<PermessoDTO> getPermessi(String user, String password);
}
问题在于,当我尝试执行查询时,它会给我这个错误:
### Error querying database. Cause: org.apache.ibatis.type.TypeException: Error setting null parameter. Most JDBC drivers require that the JdbcType must be specified for all nullable parameters. Cause: java.sql.SQLException: invalid column name
### The error may involve it.reply.ratingGateway.monitoringManagement.DB.PermessiMapper.getPermessi-Inline
### The error occurred while setting parameters
### Cause: org.apache.ibatis.type.TypeException: Error setting null parameter. Most JDBC drivers require that the JdbcType must be specified for all nullable parameters. Cause: java.sql.SQLException: Tipo di colonna non valido
我尝试使用像'xxx'和'yyy'之类的简单字符串更改#{name}
和#{password}
,然后它就可以了。
我也可以说调试代码,我已经看到我传递的参数都不是空的。
有什么想法吗?
答案 0 :(得分:0)
我终于修好了, 很简单似乎它不喜欢用这种方式获得2个字符串的想法,
所以我改变了这样:
public ArrayList<PermessoDTO> getPermessi(UserDTO user);
其中UserDTO包含属性用户和密码。
再见!