Пример #1
0
  private void doUpdate(Session hSession) throws HibernateException {
    MetadataTable tUpdates = getMetadataTable(MetadataTable.UPDATE);

    Iterator i = mClasses.values().iterator();
    while (i.hasNext()) {
      MClass clazz = (MClass) i.next();
      Set hUpdates = new HashSet();
      List updates = tUpdates.getDataRows(clazz.getPath());
      if (updates != null) {
        Iterator j = updates.iterator();
        while (j.hasNext()) {
          Metadata md = (Metadata) j.next();
          Update hUpdate = new Update();

          hUpdate.setMClass(clazz);

          hUpdate.setUpdateName(md.getAttribute("UpdateName"));
          hUpdate.setDescription(md.getAttribute("Description"));
          hUpdate.setKeyField(md.getAttribute("KeyField"));

          hUpdate.updateLevel();

          hSession.save(hUpdate);
          hUpdates.add(hUpdate);
          mUpdates.put(hUpdate.getPath(), hUpdate);
        }
      }
      clazz.setUpdates(hUpdates);
      hSession.saveOrUpdate(clazz);
    }
  }
 protected List getData() {
   List updates = new ArrayList();
   Update update = new Update();
   update.setUpdateName("Add");
   update.setDescription("Add a new Residential Listing");
   update.setKeyField("key");
   update.addUpdateType(new UpdateType(1));
   updates.add(update);
   return updates;
 }