Codes:
QueryRunner queryRunner = new QueryRunner();
connection = JdbcUtils.getConnection();
String sql = "SELECT id,name,address,phone FROM customer WHERE name LIKE ?";
List<Customer> list = queryRunner.query(connection,sql,new BeanListHandler<Customer>(Customer.class), "%j%");
for(Customer c: list){
System.out.println(c);
}
When I query with my own DAO code,it's OK.But with queryRunner,following exception appears:
java.sql.SQLException: ORA-00904: "NAMEIKE": invalid identifier
Query: SELECT id,name,address,phone FROM customer WHERE name LIKE ? Parameters: [%j%]
at org.apache.commons.dbutils.AbstractQueryRunner.rethrow(AbstractQueryRunner.java:392)
at org.apache.commons.dbutils.QueryRunner.query(QueryRunner.java:351)
at org.apache.commons.dbutils.QueryRunner.query(QueryRunner.java:212)
at com.lteagle.mvcapp.test.Test.main(Test.java:19)
I don't know where the invalid identifier "NAMEIKE" come from.