最近做一个项目发现一个查询运行时间很长,似乎停了。大概是这样一个queryjdbcTemplate.queryForList("select * from x,y where x.a=y.b and ? between '01-mar-2001' and '01-mar-2002'", myDate);
其中myDate是java.util.Date.完全一样的query, 仅仅把myDate 变成java.sql.Date 大概运行1秒,返回400条记录。请问在spring中查询,是不是还是都要变成java.sql.date才能做。spring的文档说
args - arguments to bind to the query (leaving it to the PreparedStatement to guess the corresponding SQL type); may also contain SqlParameterValue objects which indicate not only the argument value but also the SQL type and optionally the scale 那么 PreparedStatement to guess如果不对的话,似乎也应该异常,而不是很慢吧? 我以前没有见过这个问题,都是用java.util.date,运行没有问题。数据库是oracle 10g.这个问题的query也是10g,但是不是一个database.