java - How to initialize NamedParameterJdbcTemplate variable -
my code looks this:
namedparameterjdbctemplate stmt; string sql = "insert ....."; // <- insert statement map<string, object> named = ...; ... stmt.update(sql, named);
but when try compile program, i'm getting error message:
variable stmt might not have been initialized
stmt.update(sql, named);
^
1 error
in examples (like one), i've seen namedparameterjdbctemplate variable not initialized @ all. so, wonder i'm doing wrong here.
in tutorial, life cycle of namedparameterjdbctemplate
managed spring.
if not using namedparameterjdbctemplate
in spring context, can create namedparameterjdbctemplate
datasource
or jdbctemplate
.
here's javadoc
Comments
Post a Comment