// get persisted visible id by visible object
 public static long getSourceId(Source source) {
   for (Source s : sourceList) {
     if (s.equals(source)) {
       return s.getId();
     }
   }
   // not find in db, insert a new one
   Dao dao = (Dao) SpringUtil.getBean("dao");
   dao.insertSource(source);
   sourceList.add(source);
   return source.getId();
 }
 static {
   Dao dao = (Dao) SpringUtil.getBean("dao");
   sourceList = dao.loadAllSource();
 }