0

我有这个:

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}and #{password},然后它就可以正常工作了。

我也可以说调试代码,我已经看到我传递的两个参数都不为空。

有任何想法吗?

4

1 回答 1

0

我终于修复了它,它似乎不喜欢以这种方式获取 2 个字符串的想法,

所以我改变了这样的:

  public ArrayList<PermessoDTO> getPermessi(UserDTO user);

其中 UserDTO 包含属性用户和密码。

再见!

于 2012-04-05T07:36:17.907 回答