protected void onNotificationEnd() { try { daoContext.commitTransaction(); } catch (DaoException e) { logger.error("failed to access dao.", e); } }
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(); } }
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); } }