@Factory("mediabaseBanner") @Begin public MediabaseBanner initMediabaseBanner() { try { mediabaseBanner = (MediabaseBanner) dvdb.createQuery("from MediabaseBanner mb where mb.mediabase = :mediabase") .setParameter("mediabase", actor.getUser().getMediabase()) .getSingleResult(); } catch (NoResultException e) { mediabaseBanner = new MediabaseBanner(); mediabaseBanner.setMediabase(actor.getUser().getMediabase()); mediabaseBanner.setDisplayLatestDVD(true); mediabaseBanner.setBannerId(1l); } return mediabaseBanner; }
@End public void persist() { if (mediabaseBanner.getId() == null) dvdb.persist(mediabaseBanner); else dvdb.merge(mediabaseBanner); }