Spring - How do I avoid returning an entire table and then searching for a single row in java afterwards? -


i want query database , return 1 single row. can return entire table - code querying in daoimplementation looks so:

sqlmapclienttemplate sqlmap = getsqlclienttemplate(); list<presidents> presidents = new sqlmap.queryforlist("presidents.getallpresidents"); 

this works fine, have controller method needs return single president. currently, returning entire list method , filtering inside java individual row want. isn't great because shouldn't have request entire table every simple query.

how go adding sort of clause? don't know why can't along lines of

sqlmap.queryforrow(presidents.getpresidentbyname, "obama"); 

in president.ibatis.xml file existing bean select statement represented so:

 <select id="getallpresidents" resultmap="presidents">     select * president     </select> 


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -