Questions tagged [ejb]

Enterprise JavaBeans (EJB) is a managed, server-side component architecture for modular construction of enterprise applications. The EJB specification is one of several [Java] APIs in the [Java EE] specification.

Enterprise JavaBeans (EJB) is a managed, component architecture for modular construction of enterprise applications which runs on an . The EJB specification is one of several APIs in the specification.

See also and

Tutorials

JBoss 4 EJB 3 Tutorial

JBoss 5 EJB 3 Tutorial

Video Tutorials

EJB Video Training

Reference :

Wikipedia

Oracle

6693 questions
49
votes
4 answers

Java Component based vs Request based frameworks

I was recently asked in an interview - In java, how do you compare component based frameworks to request based frameworks? I explained EJB as an example of Component based framework and Struts as a request based framework but was not convinced if I…
user150014
  • 743
  • 2
  • 8
  • 9
47
votes
3 answers

Is it safe to manually start a new thread in Java EE?

I could not find a definitive answer to whether it is safe to spawn threads within session-scoped JSF managed beans. The thread needs to call methods on the stateless EJB instance (that was dependency-injected to the managed bean). The background is…
Dmitry Chornyi
  • 1,821
  • 4
  • 25
  • 33
47
votes
2 answers

When is it necessary or convenient to use Spring or EJB3 or all of them together?

I'm a little confused by the mixed use of JSF2+Spring+EJB3 or any combination of those. I know one of the Spring principal characteristics is dependency injection, but with JSF managed beans I can use @ManagedBean and @ManagedProperty anotations and…
user2018726
  • 638
  • 2
  • 12
  • 23
44
votes
4 answers

Difference between Java Bean and Enterprise Java Beans?

Are they different or they are used interchangeably? If they are Different, then what made them different from each other?
GuruKulki
  • 25,776
  • 50
  • 140
  • 201
43
votes
4 answers

What is the difference between EJB, hibernate, spring and JSF?

I am very confused with different java frameworks. I want to create a java server project to offer some Restful web-service, but I really dont know which framework I should choose. What is the difference between JSF, EJB, Hibernate and Spring?…
user261002
  • 2,182
  • 10
  • 46
  • 73
42
votes
2 answers

Difference between @Stateless and @Singleton

I'm following this tutorial which also uses an EJB: package exercise1; import java.util.Random; import javax.ejb.Stateless; import javax.inject.Named; @Stateless public class MessageServerBean { private int counter = 0; public String…
godzillante
  • 1,174
  • 1
  • 17
  • 32
42
votes
4 answers

What does the @EJBs annotation do?

I know roughly what this construction does: it creates a SomeType EJB and injects the object into another EJB. @EJB(name="name1") SomeType someVariable Now I have a class which starts like this: (I give all class-level annotations, even though I…
hyperman
  • 1,324
  • 1
  • 11
  • 21
41
votes
2 answers

JSF Controller, Service and DAO

I'm trying to get used to how JSF works with regards to accessing data (coming from a spring background) I'm creating a simple example that maintains a list of users, I have something like
PDStat
  • 5,513
  • 10
  • 51
  • 86
41
votes
5 answers

Difference between Javabean and EJB

Just a simple question from a relative Java newbie: what is the difference between a JavaBean and an EJB?
LRE
  • 956
  • 1
  • 10
  • 15
39
votes
2 answers

When does @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) commit?

An EJB method named Aby calls another EJB method named Bob Bob is marked with @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) When does bob transaction commits?: a) when bob invocation ends b) when aby invocation ends c) other. when?
SDReyes
  • 9,798
  • 16
  • 53
  • 92
38
votes
2 answers

Is it discouraged to use Java 8 parallel streams inside a Java EE container?

Given that spawning threads in Java EE containers are discouraged. Would using the Java 8 parallel streams, which may spawn threads, inside Java EE be discouraged too?
Luís Bianchin
  • 2,327
  • 1
  • 28
  • 36
38
votes
6 answers

Why do we need separate Remote and Local interfaces for EJB 3.0 session beans

I was wondering why do we need separate Remote and Local intefaces for EJB 3.0 Session beans. I guess most of the time they would both be defining the same contract. Why cant I have a common interface and in my Bean I should just be able to say that…
Vikas Kedia
  • 648
  • 1
  • 7
  • 9
37
votes
4 answers

How to deploy EJB based application on Tomcat

I developed a small Java application using EJB3 and JSF. But I want deploy it on Tomcat server (not GlassFish and not in Netbeans IDE it has to be independent of Netbeans). How can I deploy it on Tomcat?
MYE
  • 983
  • 8
  • 24
  • 41
37
votes
1 answer

What to put into jta-data-source of persistence.xml?

What value should I place into of my persistence.xml? In glassfish admin panel I created a datasource name "abcDS". In my jndi.properties (inside src/test/resources) I defined it like…
yegor256
  • 102,010
  • 123
  • 446
  • 597
37
votes
9 answers

Why is PostConstruct not called?

I am working on a simple Java EE application. I have class like this: import javax.annotation.PostConstruct; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import…
Koray Tugay
  • 22,894
  • 45
  • 188
  • 319