Mercurial > lada > lada-server
changeset 159:32ccc25c5f1e
New Manager for LKommentarM objects.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Fri, 14 Jun 2013 15:18:19 +0200 |
parents | 034db67bc1e8 |
children | e4367bb761a7 |
files | src/main/java/de/intevation/lada/manage/LKommentarMManager.java |
diffstat | 1 files changed, 72 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/de/intevation/lada/manage/LKommentarMManager.java Fri Jun 14 15:18:19 2013 +0200 @@ -0,0 +1,72 @@ +package de.intevation.lada.manage; + +import javax.ejb.EJBTransactionRolledbackException; +import javax.ejb.Stateless; +import javax.ejb.TransactionAttribute; +import javax.ejb.TransactionAttributeType; +import javax.inject.Inject; +import javax.persistence.EntityExistsException; +import javax.persistence.EntityManager; +import javax.persistence.TransactionRequiredException; + +import de.intevation.lada.model.LKommentarM; + +/** + * This Manager provides databse operations for LKommentarM objects. + * + * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a> + */ +@Stateless +public class LKommentarMManager +{ + @Inject + private EntityManager em; + + /** + * Delete a LKommentarM object by id. + * + * @param id + * @throws Exception + */ + @TransactionAttribute(TransactionAttributeType.REQUIRED) + public void delete(String id) throws Exception { + LKommentarM kommentar = em.find(LKommentarM.class, id); + em.remove(kommentar); + } + + /** + * Persist a new LKommentarM object in the database. + * + * @param kommentar The new LKommentarM object. + * + * @throws EntityExistsException + * @throws IllegalArgumentException + * @throws TransactionRequiredException + */ + @TransactionAttribute(TransactionAttributeType.REQUIRED) + public void create(LKommentarM kommentar) + throws EntityExistsException, + IllegalArgumentException, + EJBTransactionRolledbackException, + TransactionRequiredException { + em.persist(kommentar); + } + + /** + * Updates a LKommentarM object in the database. + * + * @param kommentar The new LKommentarM object. + * + * @throws EntityExistsException + * @throws IllegalArgumentException + * @throws TransactionRequiredException + */ + @TransactionAttribute(TransactionAttributeType.REQUIRED) + public void update(LKommentarM kommentar) + throws EntityExistsException, + IllegalArgumentException, + EJBTransactionRolledbackException, + TransactionRequiredException { + em.merge(kommentar); + } +}