ejb

Field values are not being modified on PreUpdate callback

故事扮演 提交于 2019-12-24 12:34:09
问题 I've defined the following class as as default Entity Listener, so every time I call the persist() or merge() methods this code will be executed automatically: public class StringProcessorListener { @PrePersist @PreUpdate public void formatStrings(Object object) { try { for (Field f : object.getClass().getDeclaredFields()) { if (f.getType().equals(String.class)) { f.setAccessible(true); if (f.get(object) != null) { f.set(object, f.get(object).toString().toUpperCase()); } } } } catch

reference for ejb jboss and eclipse development

别等时光非礼了梦想. 提交于 2019-12-24 12:19:01
问题 is there a reference or book, maybe a tutorial that can get me started with ejb using the technologies that I have mentioned above? thank you 回答1: You can take a look at the JBoss Tools if you're interested in developing Java EE applications in Eclipse. If you already know EJB (and if you don't there is quite good Enterprise JavaBeans 3.1 book) you know you can develop your EJB's as plain POJO's just with annotations. No need for fancy plugins here. You would, however, need a plugin to easily

Jsf validation error (shown by h:message) while updating Model, why?

五迷三道 提交于 2019-12-24 12:18:47
问题 List.xhtml: <h:selectOneMenu value="#{produtosController.selected.codigo}"> <f:selectItems value="#{produtosController.itemsAvailableSelectOne}"/> </h:selectOneMenu> <h:commandButton action="#{produtosController.createByCodigos}" value="Buscar" /> Controller Class method: public String createByCodigos(){ items = new ListDataModel(ejbFacade.findByCodigos(current.getCodigo())); updateCurrentItem(); return "List"; } Facade Class method: public List<Produtos> findByCodigos(Integer codigo){ Query

How to dependecy inject an EJB3 constructor?

回眸只為那壹抹淺笑 提交于 2019-12-24 12:02:19
问题 According to EJB3 DI documentation it is possible to inject fields and setters. But how to inject a bean constructor ? 回答1: The EJB specification does not support constructor injection. The EJB programming model only uses the no-arg constructor, and can then perform field or setter method injection after the instance has been constructed. That said, EJB 3.1 is part of EE 6, which includes CDI. If your EJB module is a CDI BDA (bean deployment archive) because it includes beans.xml, then you

NullPointerException: Unable to create the container entity manager factory for the org.jbpm.persistence.jpa persistence unit

前提是你 提交于 2019-12-24 10:45:19
问题 I'm attaching the top few lines of my persistence.xml and ormTasks.xml Persistence.xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <persistence version="2.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd" xmlns:orm="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns

JAX-RS REST service + EJB on WildFly 10, always adds no-cache HTTP header in responses

江枫思渺然 提交于 2019-12-24 09:49:56
问题 I have wrote a stateless EJB that provides a rest service. I am working with the Wildfly 10 application server and developing with the Netbeans IDE. I have tried to cache the return values of few methods for few hours by adding a max-age header in the http-response of the service methods. Please consider this is a simplified version of my bean: @Stateless @DeclareRoles({"role1","role2"}) @RolesAllowed({"role1","role2"}) @Path("api-dummy") public class DummyApiREST { @EJB private StuffFacade

Static vs Instance members in Stateless EJBs

旧巷老猫 提交于 2019-12-24 08:48:34
问题 I have a stateless session bean which needs access to a factory class. Is it best to declare this factory class as a static or instance member in the SLSB? Am I correct in saying that, as SLSBs are reused, only one instance of the factory will be created per bean (when going with the instance member option), as opposed to one instance per request? 回答1: SLSB instances are pooled, and hence serve potentially many requests over their lifetime, so as you say instance variables are not recreated

Log4J not really excluded in JBoss EAP6/AS7

无人久伴 提交于 2019-12-24 06:55:11
问题 In jboss-deployment-structure.xml from application war file, I have exclude log4j modules or so <?xml version="1.0" encoding="UTF-8"?> <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0"> <deployment> <dependencies> <module name="oracle" /> </dependencies> <exclusions> <module name="org.apache.log4j" /> <module name="org.apache.commons.logging" /> <module name="org.jboss.logging" /> <module name="org.jboss.logging.jul-to-slf4j-stub" /> <module name="org.jboss.logmanager" />

EJB3 Stateless Bean is always null in REST-WebService (Glassfish3, EJB3, Stateless Bean,)

断了今生、忘了曾经 提交于 2019-12-24 05:58:53
问题 I hope you can help me with this: I have a WebProject created with Eclipse as a dynamic web project, running on a Glassfish3 Server. I’m using EJB 3.0 to create a stateless Façade(@stateless Annotation) that implements my business logic: @Stateless public class Facade { public void test(){ System.out.println("test hat geklappt!!"); } } Additionally I’m using a RESTRessource to offer my REST WS that uses my EJB with (@EJB Annotation) the business logic: @RequestScoped @Path("/prescriptions")

Does ejb stateless class has to be public?

拜拜、爱过 提交于 2019-12-24 05:30:04
问题 Can @Stateless class have different modifiers than public? In documentation I have only found constraints of constructor/methods visibility, but nothing interesting about class level access. 回答1: According to ejb3-1 specification: 4.9.2 Session Bean Class The following are the requirements for the session bean class: • The class must be defined as public, must not be final, and must not be abstract. The class must be a top level class 来源: https://stackoverflow.com/questions/25867608/does-ejb