在网页中显示表中没有的字段或数据时_Transient

在实体类中加入:(ReflectionUtils是工具类)

//      @Transient

//      publicLong getPoscount() {

//              

//               return"select count(postationid) from Station wherepostationid=+postationid";

//      }

         @Transient

         @SuppressWarnings("unchecked")

         publicLong getPoscount() throws Exception{

                   //得到站点下的终端数 根据绑定表

                   List<String>list = ReflectionUtils.fetchElementPropertyToList(poschanges, "gsn");

//               intcount = 0;

                   //根据set中元素不能相同,处理后得到元素数量

                   Setset = new HashSet<String>();

                   if(list!=null&&list.size()>0){

                            for(Stringstr:list){

                                     if(str!=null&&!"".equals(str)){

                                               set.add(str);

                                               //count++;

                                     }

                            }

                   }

                   returnLong.parseLong(set.size()+"");

                   //Long.parseLong(ReflectionUtils.fetchElementPropertyToList(poschanges,"gsn").size() + "");

         }



你可能感兴趣的:(exception,list,null,工具,终端)