-
Jul 15th, 2012, 08:25 AM
#1
How to pass an int parameter to NamedParameterJdbcTemplate.query()
Hi,
Since i am new to spring can somebody help me on the below issue.
I am trying to call NamedParameterJdbcTemplate.query(String query,Map param, RowMapper rm)
I need to pass an integer value to the param map.
The query is something like SELECT NAME FROM TABLE1 WHERE AGE = :age and the map is something like the below,
Map<String, Object> params = new HashMap<String, Object>();
params.put("age", new Integer(20));
So when i call NamedParameterJdbcTemplate.query("SELECT NAME FROM TABLE1 WHERE AGE = :age",params, rm), the place holder :age is never replaced with 20 and the query always fails.
What object type has to be used when i have an integer parameter..?.
My db is Oracle and column type is NUMBER.
-
Jul 16th, 2012, 01:06 AM
#2
am a big stupid only..it was the problem with the rowmapper..
..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules