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

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -