jeudi 7 septembre 2017

java reflection in apache phoenix spring jdbc template

Assuming I have a class

class Person {
     String name;
     Integer age;
}

Object[] param= new Object[]{person.getName, person.getAge};
Object[] param1 = new Object[]{PropertyBean.getProperty("name"),PropertyBean.getProperty("age")}

what is the difference between param and param1? My understanding they are the same. But when i use the param1 in a jdbc connection i have a problem.

String sql="INSERT INTO table (name, age) VALUES (?,?)"
JDBCTemplate.update(sql, param1);//fail
JDBCTemplate.update(sql, param);//success

Does anyone know the reason?





Aucun commentaire:

Enregistrer un commentaire