I've created a prepared statement from within a service in spring. It's very simple, but quite long. Initially, it was working, but is not longer.
Here's the code:
String sql = "insert into myData.myTable " +
" (version_id, "+
" Category, "+
" my_name, "+
" my_id, "+
...bunch of fields ....
" lastField "+
" ) "+
" select "+
" ?, "+
" Category, "+
" ?, "+
" lastField "+
" from myData.myOtherFile where my_id = ?";
Connection conn = dataSource.getConnection();
PreparedStatement ps = conn.prepareStatement(sql);
ps.setLong(1, version.getId());
ps.setString(2, pp.getName());
ps.setLong(3, pp.getMyId());
ps.executeUpdate();
ps.close();
Now, it's not working. No exceptions or anything - it just doesn't insert. I also tried using JdbcTemplate, and it doesn't work, although when I executed the SQL statement shown by hibernate - it worked.
Any ideas?