protected boolean onNotificationStart() { try { daoContext.beginTransaction(); return true; } catch (DaoException e) { logger.error("failed to access dao.", e); return false; } }
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(); } }