2012-04-04 40 views
0

我有這樣的:問題與「iBatis的」,錯誤設置爲null參數

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 

我試圖改變#{name}#{password}像一個簡單的字符串,如'xxx'和'yyy',然後它工作得很好。

我也可以說調試代碼,我看到我傳遞的兩個參數都不是null。

任何想法?

回答

0

我終於固定它, 簡單看來,它不喜歡把自己2串這樣的想法,

所以我改變這樣的:

public ArrayList<PermessoDTO> getPermessi(UserDTO user); 

哪裏UserDTO包含屬性用戶和密碼。

再見!