import java.text.MessageFormat;
import java.util.List;
import javax.ejb.Stateless;
+import javax.persistence.NoResultException;
import javax.persistence.Query;
+import org.mxchange.jcontactsbusiness.exceptions.branchoffice.BranchOfficeNotFoundException;
import org.mxchange.jfinancials.database.BaseFinancialsDatabaseBean;
/**
return list;
}
+ @Override
+ public BranchOffice findBranchOfficeById (final Long branchOfficeId) throws BranchOfficeNotFoundException {
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findBranchOfficeById: CALLED!", this.getClass().getSimpleName())); //NOI18N
+
+ // Get query
+ final Query query = this.getEntityManager().createNamedQuery("SearchBranchOfficeById", CompanyBranchOffice.class); //NOI18N
+
+ // Set parameter
+ query.setParameter("branchOfficeId", branchOfficeId); //NOI18N
+
+ // Get single instance
+ final BranchOffice branchOffice;
+
+ // Try to find a result
+ try {
+ // Find a single result
+ branchOffice = (BranchOffice) query.getSingleResult();
+
+ // Log trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findBranchOfficeById: Found branchOffice={1}", this.getClass().getSimpleName(), branchOffice)); //NOI18N
+ } catch (final NoResultException ex) {
+ // No result found
+ throw new BranchOfficeNotFoundException(branchOfficeId, ex);
+ }
+
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findBranchOfficeById: branchOffice={1} - EXIT!", this.getClass().getSimpleName(), branchOffice)); //NOI18N
+
+ // Return it
+ return branchOffice;
+ }
+
}
* @author Roland Häder<roland@mxchange.org>
*/
@Startup
-@Singleton (name = "mobileprovider", description = "A singleton session-scoped bean for SMS provider informations")
+@Singleton (name = "mobileProvider", description = "A singleton session-scoped bean for SMS provider informations")
public class FinancialsMobileProviderSingletonBean extends BaseFinancialsDatabaseBean implements MobileProviderSingletonBeanRemote {
/**