コード例 #1
0
 protected void onNotificationEnd() {
   try {
     daoContext.commitTransaction();
   } catch (DaoException e) {
     logger.error("failed to access dao.", e);
   }
 }
コード例 #2
0
 protected boolean onNotificationStart() {
   try {
     daoContext.beginTransaction();
     return true;
   } catch (DaoException e) {
     logger.error("failed to access dao.", e);
     return false;
   }
 }
コード例 #3
0
ファイル: SetupGrids.java プロジェクト: haruo31/langrid
 public static void main(String[] args) throws Exception {
   System.setProperty(
       "jp.go.nict.langrid.dao.hibernate.LangridSessionFactory.hibernate.cfg",
       "hibernate.cfg.xml");
   File baseDir = new File("contents_grids");
   DaoFactory f = DaoFactory.createInstance();
   DaoContext c = f.getDaoContext();
   c.beginTransaction();
   try {
     clearAll(f);
     List<String> gridIds = setupGrids(f, baseDir);
     for (String gid : gridIds) {
       setupUsers(f, gid, baseDir);
       setupResources(f, gid, baseDir);
       setupExternalServices(f, gid, baseDir);
     }
   } finally {
     c.commitTransaction();
   }
 }
コード例 #4
0
 protected void doUpdate(Serializable id, Set<String> modifiedProperties) {
   try {
     getController().publish(new UserData(daoContext.loadEntity(User.class, id)));
     logger.info("published[User(id=" + id + ")]");
   } catch (ControllerException e) {
     logger.error("failed to publish instance.", e);
   } catch (DaoException e) {
     logger.error("failed to access dao.", e);
   } catch (DataConvertException e) {
     logger.error("failed to convert data.", e);
   }
 }