This post helped me a bit, explaining that JdbcTemplate will figure out which column to fill on its own. However, it means that there's no need to pass in the types, so why/when should we do it?
Another related question: I accidentally passed an Object[]
rather than int[]
and the app gave me an exception in mysql: Data truncation: Data too long for column 'username' at row 1
. However, the parameter was just "test" and the column was VARCHAR(60). Though I realize that Object[]
will not be autoboxed to int[]
, but what makes it "too long"? I think it's related to the implementation of how does update()
use types, but I cannot figure it out...
Thank you for answering!