当前位置: 代码迷 >> J2SE >> 从数据库中取得多字段的list,怎样查询出所要知道的结果?解决办法
  详细解决方案

从数据库中取得多字段的list,怎样查询出所要知道的结果?解决办法

热度:12   发布时间:2016-04-24 14:32:18.0
从数据库中取得多字段的list,怎样查询出所要知道的结果?
问题这样:
  用hibernate查询数据库取得结果放在list中.
  select   code,name   from   tbl;

        现在我想根据code得到name
        例如:code=1001,name=csdn_one
                    code=1002,name=csdn_two
        当我传入code=1001时,返回csnd_one;

不知道我描述的明不明白,请指点!!多谢!


------解决方案--------------------
我觉得只能循环比较吧
  相关解决方案