From 376898aa5bd021eeacad71c631a82224d8bc2949 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Fri, 9 Oct 2015 14:48:45 +0200 Subject: [PATCH] =?utf8?q?Added=20business=20method=20getUsersList()=20and?= =?utf8?q?=20implemented=20it.=20Signed-off-by:Roland=20H=C3=A4der=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../addressbook/AddressbookSessionBean.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/java/org/mxchange/addressbook/model/addressbook/AddressbookSessionBean.java b/src/java/org/mxchange/addressbook/model/addressbook/AddressbookSessionBean.java index 245c3a7..6bd71d8 100644 --- a/src/java/org/mxchange/addressbook/model/addressbook/AddressbookSessionBean.java +++ b/src/java/org/mxchange/addressbook/model/addressbook/AddressbookSessionBean.java @@ -16,10 +16,13 @@ */ package org.mxchange.addressbook.model.addressbook; +import java.util.List; import javax.ejb.EJB; import javax.ejb.Stateless; +import javax.persistence.Query; import org.mxchange.jcoreee.database.BaseDatabaseBean; import org.mxchange.jusercore.model.login.UserLoginSessionBeanRemote; +import org.mxchange.jusercore.model.user.User; /** * A stateless bean handling addressbooks @@ -39,4 +42,20 @@ public class AddressbookSessionBean extends BaseDatabaseBean implements Addressb */ @EJB private UserLoginSessionBeanRemote loginBean; + + @Override + @SuppressWarnings ("unchecked") + public List getUsersList (final User loggedInUser) { + // Get query instance + Query query = this.getEntityManager().createNamedQuery("AllUsersAddressbooks"); //NOI18N + + // Set parameter + query.setParameter("param", loggedInUser); //NOI18N + + // Get full list from JPA + List addressbooks = query.getResultList(); + + // Return it + return addressbooks; + } } -- 2.39.5