File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Spring and the fly likes BeanPropertySqlParamterSource vs ParameterMap Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "BeanPropertySqlParamterSource vs ParameterMap" Watch "BeanPropertySqlParamterSource vs ParameterMap" New topic

BeanPropertySqlParamterSource vs ParameterMap

Adam Jelinek

Joined: Feb 07, 2012
Posts: 6
I know that the BeanPropertySqlParamterSource can make things easier, and potentially prevent issues from miss typing the parameter map or row mapper, but what about performance.

I have been trying to find something online that talks about the performance difference between the two, but I have not had any luck. From what I have seen it does the BeanPropertySqlParameterSource does use reflection to call your getters and setters (not necessarily bad). I have to assume that it is a longer code path. Anyways has anyone done any testing? I keep going back and forth, but continue to lean towards coding the parameter maps and row mappers.

Bill Gorder

Joined: Mar 07, 2010
Posts: 1682

I doubt the performance difference is going to be noticeable. The fact that you are not finding any complaints online about it supports this theory. I would not prematurely optimize. If you are using it and not having performance issues than don't worry about it. Choose the method you are most comfortable with and use it.

[How To Ask Questions][Read before you PM me]
I agree. Here's the link:
subject: BeanPropertySqlParamterSource vs ParameterMap
It's not a secret anymore!