我们在项目中使用Ibatis。当查询第一次执行时,速度很慢。但之后同组查询比第一次快一点。那么查询是否在第一次执行时被编译?
最佳答案
iBbatis 与任何基于 JDBC 构建的数据库框架一样,使用 PreparedStatement
来执行 SQL 查询。来自 Java JDBC tutorial
The advantage to this is that in most cases, this SQL statement is sent to the DBMS right away, where it is compiled. As a result, the PreparedStatement object contains not just a SQL statement, but a SQL statement that has been precompiled.
所以,如果预编译是指在数据库上,那么,是的,它们是。
关于java - IBatis 中的查询是否已预编译?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18234767/