0

I've got this:

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);
}

The problem is that when I'm trying to execute the query, it gives me this error:

### 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

I've tried to change the #{name} and #{password} with a simple string like 'xxx' and 'yyy' and then it works just fine.

I can also say that debugging the code, I've seen that both the parameters I'm passing are not null.

Any ideas?

stealthyninja
  • 10,343
  • 11
  • 51
  • 59
Daniele
  • 71
  • 1
  • 2
  • 5

1 Answers1

0

I've finally fixed it, it simple seems that it doesn't like the idea of getting 2 string this way,

so i've changed like this:

  public ArrayList<PermessoDTO> getPermessi(UserDTO user);

where UserDTO contains the property user and password.

Bye!

Daniele
  • 71
  • 1
  • 2
  • 5