A session bean encapsulates business logic that can be invoked programmatically by a client over local, remote, or web service client views. More specifically, a stateless session bean does not maintain a conversational state with the client, so it is mostly used as a service(e.g. rest api, persistence-retrieval) and does specific job without the need of keeping a state.
Questions tagged [stateless-session-bean]
188 questions
1
vote
2 answers
start transaction AFTER not BEFORE start of synchronized method in singleton bean
I have a war file deployed in glassfish. We have a Singleton bean and we have 1 synchronized method in it.
@TransactionAttribute (TransactionAttributeType.REQUIRED)
public synchronized void do()
{
...
}
However, I am noticing that transaction…

user674669
- 10,681
- 15
- 72
- 105
1
vote
1 answer
synchronized method in stateless session bean not working as expected in glassfish
I have a war file deployed in glassfish. We have some stateless session beans and we have 1 synchronized method in it.
However, I am noticing that more than 1 thread is able to enter the synchronized method concurrently. Is it possible that…

user674669
- 10,681
- 15
- 72
- 105
1
vote
2 answers
Weblogic 10.3.0 : Losing a stateless session bean in the bean pool
We have a strange situation where we lose a Stateless SessionBean in a Bean Pool in Weblogic 10.3.0. Since we only have one bean in the pool, this effectively hangs all incoming calls. We do not want more than one instance in the pool because of…

KlasE
- 142
- 11
1
vote
0 answers
EJB not injected in Stateless LocalBean using @EJB
I have a Stateless Session bean which I want to inject into another Stateless Session Bean (no-interface LocalBean) using @EJB:
@Path("/user")
@LocalBean
@Stateless(mappedName = "ejb/UserServiceRest")
public class UserServiceRest extends…

guilhebl
- 8,330
- 10
- 47
- 66
1
vote
1 answer
Why use a ShoppingCart as a Stateful Sesson Bean?
One typical example of using a Stateful Session Bean is through a ShoppingCart example. We create a bean instance of the ShoppingCart class, then store this instance within a HttpSession.
However, the same can be achieved easily with the…

echipbk
- 21
- 2
1
vote
2 answers
need help in EJB stateless beans
I am new to EJB. I have a requirement of calling a method of remote stateless bean and setting a value, before calling any method on the same bean. The value set from first method call should be available to second method. I know that a stateless…

Pokuri
- 3,072
- 8
- 31
- 55
1
vote
1 answer
EJB 3.0 transactions and synchronization
Using EJB 3.0, two threads will try to run this code (that is inside a stateless session bean). Both threads are able to pass through the if statement and print out the statement.
userTransaction.begin(); //userTransaction is of class…

pablo
- 747
- 1
- 10
- 24
1
vote
1 answer
Can a Session Bean implement additional interface in addition to SB Interface?
I have a Session Bean like this:
@Stateless
@Local(MySessionBeanInterface.class)
public class MySessionBean implements MySessionBeanInterface {
}
I wanted to know if its okay to implement another interface as well. For instance, I have interface…

Kevin Rave
- 13,876
- 35
- 109
- 173
1
vote
2 answers
SessionBeans and CDI vs POJO classes
I was reading the JavaEE 6 tutorial and, while reading the SessionBean and CDI sections, I came across several doubts.
1) For what I understood, the @EJB annotation injects a SessionBean resulting in a use of the Dependency Inject pattern. I…

Miguel Ribeiro
- 8,057
- 20
- 51
- 74
1
vote
1 answer
retrieving a value from message listener and print in Main
I have 2 EJB app, A and B. A has a stateless session that send a message to app B (Message driven bean). App B send a message back to app A.
Now, I have the value I want in the message listener in the stateless session bean in A. But I need to show…

user1182637
- 91
- 2
- 3
- 10
1
vote
2 answers
Static use of Dozer Mapper
Just wondering if having a static dozer mapper like this can leads to concurrency errors :
public static Mapper mapper = new DozerBeanMapper();
public static MyDTO toDTO(MyEntity e) {
MyDTO dto = mapper.map(e, MyDTO.class);
return dto;
}
Or…

Wis
- 705
- 1
- 11
- 34
1
vote
0 answers
EJB 2.1 - TimedObject in GlassFish
I'm having problems getting an example EJB program to work.
It's from Chapter 11 of "Beginning J2EE 1.4 from Novice to Professional"
The example includes a Message-Driven Bean, but I can't seem to get the Timed Session Bean to work. I keep getting…

tygerpatch
- 55
- 8
1
vote
0 answers
can client explicitly destroy stateless session bean?
The ejb container controls the bean life-cycle, and normally client side does not need to care bean life-cycle. But I still wonder if there is a way to explicitly remove/destroy a stateless session bean instance from Method-Ready-Pool?
For stateful…

user1684651
- 390
- 1
- 8
- 21
1
vote
2 answers
Instance Variables in Stateless Session Bean - state is maintained how?
Server running on GlassFish 3.0
@Stateless(mappedName="messengerservice")
public class MessengerService implements MsnService{
int count;
@Override
public int getCount() {
// TODO Auto-generated method stub
count =…

Sudhakar
- 4,823
- 2
- 35
- 42
1
vote
1 answer
Service facades, detached entities and eager fetching
Service facades are usually implemented as stateless session beans, which means that any entities they possibly return will be detached immediately. This makes me think that any entity returned as a result of a service facade business method should…

Arash Shahkar
- 655
- 3
- 12
- 24