ejb-3.0

EJB3 - obtaining bean via injection vs lookup - what are the differences, implications, gotchas?

萝らか妹 提交于 2019-12-06 23:05:32
问题 There are two ways I know of to obtain an EJB instance: dependency injection in servlets and EJBs via the @EJB annotation JNDI lookup via Context.lookup anywhere What are the differences, implications and gotchas in using either of these approaches? Are they the same? Is dependency injection faster than lookup? What about transaction handling and object lifecycle management? Things I'm aware of include: annotation works with servlets and and EJBs only convenient syntax container independent

Glassfish 3.0: Exception while deploying ejb module…Invalid ejb j ar: it contains zero ejb

萝らか妹 提交于 2019-12-06 19:22:27
I have a very simple ejb 3.0 module with maven, it has only two session beans one stateless and the other is singleton...when I am trying to deploy the project on Glassfish 3.0 server, I got this exception: Error occurred during deployment: Exception while deploying the app : Invalid ejb jar : it contains zero ejb. Note: 1. A valid ejb jar requires at least one session, entity (1.x/2.x style), or message-driven bean. 2. EJB3+ entity beans (@Entity) are POJOs and please package them as library jar. 3. If the jar file contains valid EJBs which are annotated with EJB component level annotations (

Am I using EJBs properly?

ぐ巨炮叔叔 提交于 2019-12-06 15:09:50
I am using a JEE6 stack including JPA 2.0, JSF 2.0, EJB 3.1 etc. The way my architecture is setup is the following: I have JPA annotated DAOs using hibernate as my JPA provider. I have JSF Managed beans which correspond to my facelet/xhtml pages. I have EJBs that handle all of my database requests. My XHTML pages have JSF EL which make calls to my Managed beans. My managed beans contain references to my DAO entities which are managed by EJBs. For example, I have a user entity which is mapped to a db table. I have a user EJB which handles all CRUD operations that return Users. I have a page

Migration of Legacy Application : EJB3 or Spring

心已入冬 提交于 2019-12-06 13:40:22
I have legacy application using struts & ejb2.0 , hibernate v3.0 running on JBoss v4.0 and now we have do migration of that application to new technology stack. We are exploring pros and cons of different technology stack and right now we have two options to decide from: EJB3.0 & JSF , Hibernate v4 on Jboss 7 or Spring & Hibernate v4 on tomcat. What parameters should I be considering to select one or the other or vice-versa? Update: Which of EJB3.0 and Spring has efficient community support, side note - ejb3.0 tag has 1097 questions and spring has 13297, and so some how am getting inclined

Possible to access remote EJBs from a custom LoginModule?

妖精的绣舞 提交于 2019-12-06 13:21:10
I found some nice hints on how to write a custom realm and loginModule. I'm wondering though if it is possible to access a remote EJB within the custom loginModule. In my case, I have remote EJBs that provide access to user-entities (via JPA) -- can I use them (e.g. via @EJB annotation)? Ok, I found the answer myself: works fine! I can get a reference to the remote SLSB via an InitialContext. Here's the code: public class UserLoginModule extends AppservPasswordLoginModule { Logger log = Logger.getLogger(this.getClass().getName()); private UserFacadeLocal userFacade; public UserLoginModule() {

Weblogic 10.3.5 & EJB 3 JNDI names

*爱你&永不变心* 提交于 2019-12-06 12:30:58
Could someone tell me where I can find infos on the default JNDI naming for EJB 3 ? Does Weblogic use portable JNDI names like Glassfish? Can I find (like for Glassfish) a trace of EJB deployment with JNDI names used? For example : an interface (Service) with only @Remote a bean (ServiceImpl) with only @Stateless implementing the interface everything packaged in an .ear file (service-application-1.0) When deploying on Weblogic the only JNDI reference I see is: service-application-1.0service-application-1.0_jarServiceImpl_Home but I can't use that name with a context lookup. If I do Service

Is there a Problem with JPA Entities, Oracle 10g and Calendar Type properties?

耗尽温柔 提交于 2019-12-06 12:00:37
问题 I'm experiencing the following very annoying behaviour when using JPA entitys in conjunction with Oracle 10g. Suppose you have the following entity. @Entity @Table(name = "T_Order") public class TOrder implements Serializable { private static final long serialVersionUID = 2235742302377173533L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private Integer id; @Column(name = "activationDate") private Calendar activationDate; public Integer getId() { return id; } public void setId(Integer

Can we use both Stateless and Stateful session beans in a J2EE application?

六月ゝ 毕业季﹏ 提交于 2019-12-06 11:47:34
问题 Is it good way to use both Stateless and Stateful session beans for the different modules if the requirement demands ? 回答1: You question is quite vague, but it seems like you basically ask for advice whether it's good to use either stateless or stateful session beans. Stateless session beans (SLSB) are definitively easy to use. There is almost nothing to configure, and they are ideal to expose service. Stateful session beans (SFSB) are superficially similar to SLSB. But the fact their are

EJB3 vs Data Access Objects

梦想与她 提交于 2019-12-06 10:54:50
问题 I am working on a project where we need to decide how we are going to expose our persistence layer. There are currently two options on the table: 1) Use plain DAOs. These would implement an interface and be injected (probably using Weld) in the Business Components which are EJBs. Internally they would use JPA/Hibernate for persistence. 2) Rather than injecting the DAOs using Weld, they would be implemented as EJBs, and injected with @EJB in the Business Components. Does it really make sense

CDI params in @PostConstruct

送分小仙女□ 提交于 2019-12-06 08:52:09
I think my question is similar to this but haven't found it to work <f:metadata> <f:viewParam id="id" name="id" value="#{detailsBean.id}"/> </f:metadata> Why can't I do this with @Named and utilize CDI: @Named @RequestScoped public class DetailsBean { private Contacts detailsContact; @EJB ContactsFacade contactsEJB; private int id; public DetailsBean() { System.out.println("details bean called"); } @PostConstruct public void onLoad() { detailsContact = contactsEJB.find(id); } I'm not able to log the id. Of course, @ManagedProperty is incompatible with CDI. *****UPDATE***** some xhtml: <?xml