• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

ParameterizedSingleColumnRowMapper. Why doesn't normal constructor set requiredType?

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I had written the following code expecting it to work:



It was actually creating a list of Integer objects, not Long objects! I now understand this is because the requiredType class wasn't being set within the mapper so it was looking at the result set meta data for the sql type and determining it was best mapped to Integer.

Replacing it with this form does the trick:



Is it not possible for Spring to set the required type in the plain constructor form? Doesn't the ParameterizedSingleColumnRowMapper have access to the type that it's been parameterized with?

I'm annoyed that I've been caught out by this and suspect it won't be the first time!

Thanks,

Ed
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic