protected Site retrieveDefaultSite(final boolean persistentResult) { //Provide an entity manager in view, if we don't already have one, to facilitate a larger scope //for the session and avoid lazy init problems. This should only cause a connection borrow from the //connection pool if L2 cache is not effective. final Site[] response = new Site[1]; transUtil.runOptionalEntityManagerInViewOperation(new Runnable() { @Override public void run() { Site defaultSite = siteDao.retrieveDefaultSite(); if (persistentResult) { response[0] = defaultSite; } else { response[0] = getNonPersistentSite(defaultSite); } } }); return response[0]; }
protected Site retrieveSiteById(final Long id, final boolean persistentResult) { //Provide an entity manager in view, if we don't already have one, to facilitate a larger scope //for the session and avoid lazy init problems. This should only cause a connection borrow from the //connection pool if L2 cache is not effective. if (id == null) { return null; } final Site[] response = new Site[1]; transUtil.runOptionalEntityManagerInViewOperation(new Runnable() { @Override public void run() { Site site = siteDao.retrieve(id); if (persistentResult) { response[0] = site; } else { response[0] = getNonPersistentSite(site); } } }); return response[0]; }
transUtil.runOptionalEntityManagerInViewOperation(new Runnable() { @Override public void run() {
protected List<Site> findAllSites(final boolean persistentResult) { //Provide an entity manager in view, if we don't already have one, to facilitate a larger scope //for the session and avoid lazy init problems. This should only cause a connection borrow from the //connection pool if L2 cache is not effective. final List<Site> response = new ArrayList<Site>(); transUtil.runOptionalEntityManagerInViewOperation(new Runnable() { @Override public void run() { List<Site> sites = siteDao.readAllActiveSites(); for (Site site : sites) { if (persistentResult) { response.add(site); } else { response.add(getNonPersistentSite(site)); } } } }); return response; }