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

从数据库中取得多字段的list,怎样查询出所要知道的结果?问题这样:  用hibernate查询数据库取得结果放在lis

从数据库中取得多字段的list,怎样查询出所要知道的结果?
问题这样:
  用hibernate查询数据库取得结果放在list中.
  select   code,name   from   tbl;

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

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


[解决办法]
我觉得只能循环比较吧