예제 #1
0
 // 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();
 }
예제 #2
0
 static {
   Dao dao = (Dao) SpringUtil.getBean("dao");
   sourceList = dao.loadAllSource();
 }