Refine search
/** * JAX-RS resource used to reload the first application. * This resource is only registered inside the second application. * * @author Jakub Podlesak (jakub.podlesak at oracle.com) */ @Stateless @Path("reload") public class ReloaderResource { @EJB EjbReloaderService ejbReloaderService; @GET public void reloadTheOtherApp() { ejbReloaderService.reload(); } }
/** * @author Arun Gupta */ @Path("employee") @Stateless public class EmployeeResource { @PersistenceContext EntityManager em; @GET @Produces("application/xml") public Employee[] get() { return em.createNamedQuery("Employee.findAll", Employee.class).getResultList().toArray(new Employee[0]); } }
@Stateless @TransactionManagement(TransactionManagementType.BEAN) public class ManagedComponent { @PersistenceContext private EntityManager entityManager; @Inject private UserTransaction userTransaction; @Inject private UnManagedComponent helper;
@Stateless @Remote(InvocationCounterService.class) @Local(InvocationCounterServiceLocal.class) public class InvocationCounterServiceBean implements InvocationCounterService, InvocationCounterServiceLocal { @Inject private InvocationCounter invocationCounter; public int getNumOfInvocations() { return invocationCounter.incrementAndGet(); } }
@Stateless public class ActorService { @PersistenceContext private EntityManager em; public Actor findById(int id) { Actor actor = em.find(Actor.class, id); actor.getRoles(); return actor; } }
/** * JAX-RS resource backed by a stateless EJB bean. * * @author Jakub Podlesak (jakub.podlesak at oracle.com) */ @Stateless @Path("stateless") public class StatelessResource { @EJB EjbCounterResource counter; @Context UriInfo uriInfo; @GET public int getCount() { return counter.getCount(); } @GET @Path("{uriInfo}") public String getPath() { return uriInfo != null ? uriInfo.getPath() : "uri info is null"; } }
@Stateless public class CadastroClienteEJB { @PersistenceContext(unitName="projetoGlassfishPU") private EntityManager em; public void salvar(Cliente cliente) { em.persist(cliente); } @SuppressWarnings("unchecked") public List<Cliente> buscarTodos() { return em.createQuery("from Cliente c").getResultList(); } }
/** * Conformance Rest Service * * @author Peter Van Houte */ // START SNIPPET: jax-rs-conformance @Path("") @Stateless @Produces({ MediaType.APPLICATION_JSON, Constants.CT_FHIR_JSON, Constants.CT_FHIR_XML }) public class JaxRsConformanceProvider extends AbstractJaxRsConformanceProvider { @EJB private JaxRsPatientRestProvider provider; public JaxRsConformanceProvider() { super("My Server Description", "My Server Name", "My Server Version"); } @Override protected ConcurrentHashMap<Class<? extends IResourceProvider>, IResourceProvider> getProviders() { ConcurrentHashMap<Class<? extends IResourceProvider>, IResourceProvider> map = new ConcurrentHashMap<Class<? extends IResourceProvider>, IResourceProvider>(); map.put(JaxRsConformanceProvider.class, this); map.put(JaxRsPatientRestProvider.class, provider); return map; } } // END SNIPPET: jax-rs-conformance
@Stateless(name="teiid-database-service") public class DatabaseServiceBean implements DatabaseServiceLocal { @PersistenceContext private EntityManager em; public void log(CommandLogMessage msg) { CommandEnitity entity = new CommandEnitity(msg); em.persist(entity); } public void log(AuditMessage msg) { AuditEnitity entity = new AuditEnitity(msg); em.persist(entity); } }
@Stateless(name="ProcessApplicationService", mappedName="ProcessApplicationService") @Local(ProcessApplicationService.class) @TransactionAttribute(TransactionAttributeType.SUPPORTS) public class EjbProcessApplicationService implements ProcessApplicationService { @EJB protected EjbBpmPlatformBootstrap ejbBpmPlatform;
/** * * @author ellenk */ @Stateless public class CustomFieldServiceBean { @PersistenceContext(unitName = "VDCNet-ejbPU") private EntityManager em; public CustomFieldMap findByTemplateField(String template, String field) { try { CustomFieldMap map = (CustomFieldMap) em.createNamedQuery("CustomFieldMap.findByTemplateField").setParameter("template", template).setParameter("field", field).getSingleResult(); return map; } catch (Exception ex) { System.out.println("Exception "+ ex + "template: "+template+" field: "+ field); return null; } } }
@Stateless public class MetaLogFacade extends AbstractFacade<MetaLog> { private static final Logger logger = Logger.getLogger(MetaLogFacade.class. getName()); @PersistenceContext(unitName = "kthfsPU") private EntityManager em; public MetaLogFacade() { super(MetaLog.class); } @Override protected EntityManager getEntityManager() { return em; } public void persist(MetaLog metaLog) { em.persist(metaLog); } }
@Stateless @EJB(name = "java:global/test/IdentityServiceBean", beanInterface = IdentityService.class) public class IdentityServiceBean implements IdentityService { private static final Log LOG = LogFactory.getLog(IdentityServiceBean.class); public IdentityRequest getIdentityRequest() { LOG.debug("getIdentityRequest"); IdentityRequest identityRequest = new IdentityRequest(true, true, true, true, true); return identityRequest; } }