*/
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
*/
@EJB
private UserLoginSessionBeanRemote loginBean;
+
+ @Override
+ @SuppressWarnings ("unchecked")
+ public List<Addressbook> 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<Addressbook> addressbooks = query.getResultList();
+
+ // Return it
+ return addressbooks;
+ }
}