There is a table in postgres DB test1 having schema :[![enter image description here](https://i.stack.imgur.com/PfAFV.jpg)](https://i.stack.imgur.com/PfAFV.jpg)

We are using spring frameworks jdbcTemplate to insert data as below: 

```
Object[] params = {"978","tour"};

jdbcTemplate.update("insert into test1 values (?,?)", params);

```

But this gives the exception :

> 
> org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [insert into test1 values (?,?)]; nested exception is org.postgresql.util.PSQLException: *ERROR: column "id" is of type integer but expression is of type character varying*
>  ERROR: column "id" is of type integer but expression is of type character varying
> 
> 
> 

This works for Oracle database through implicit type conversion, but postgres does nOt seem to work that way.

**Could this be an issue with postgres driver?** 

A workaround would be to cast explicitly:

```
insert into test1 values (?::numeric ,?)

```

But is there better way to do the conversion as this does not seem like a good solution since there are lot of queries to be modified and also there can be other such casting issues too. 

Is there some parameter that can be set at DB level to perform an auto cast?