I am struggling with a code that uses Spring's SimpleJdbcInsert.
SimpleJdbcInsert jdbcInsert = (new SimpleJdbcInsert(transactionManager.getDataSource())
.withTableName(MY_TABLE).usingGeneratedKeyColumns("my_table_id")).usingColumns(MY_COLUMNS);
This works fine when I use it on a connection that has the default schema as "PUBLIC", as in where I do not have any schemas set up. However, when I add a few schemas, and then make MY_SCHEMA1 as the default schema for the connection, this does not work any more. It does not find the table MY_TABLE at all.
It starts working if I add .withSchemaName(MY_SCHEMA1) to SimpleJdbcInsert. However, I do not have that option.
Please help.
Note: I am using this on H2 and DB2.