Questions tagged [stateful-session-bean]

A stateful session bean is an enterprise bean (EJB component) that acts as a server-side extension of the client that uses it. The stateful session bean is created by a client and will work for only that client until the client connection is dropped or the bean is explicitly removed.

A stateful session bean is an enterprise bean (EJB component) that acts as a server-side extension of the client that uses it. The stateful session bean is created by a client and will work for only that client until the client connection is dropped or the bean is explicitly removed.

117 questions
97
votes
7 answers

Stateless and Stateful Enterprise Java Beans

I am going through the Java EE 6 tutorial and I am trying to understand the difference between stateless and stateful session beans. If stateless session beans do not retain their state in between method calls, why is my program acting the way it…
Stanley kelly
  • 1,078
  • 1
  • 8
  • 8
85
votes
2 answers

When to use Stateful session bean over Stateless session bean?

A stateful session bean is defined as follows: Stateful Session Beans The state of an object consists of the values of its instance variables. In a stateful session bean, the instance variables represent the state of a unique client-bean…
sheidaei
  • 8,892
  • 19
  • 58
  • 84
14
votes
2 answers

Why use stateful session beans?

I'm learning EJB3 and I'm just curious when it's convenient to use SFSB? I can't find any nice example when SFSB realy solve easily some complex problem. Actually I see that SLSB can be used as web-services and this is convenient. But I don't know…
Roman
  • 59,060
  • 84
  • 230
  • 322
12
votes
1 answer

sessionscoped managed bean vs stateful ejb

If I have a @ManagedBean that's @SessionScoped, why would I use a @Stateful EJB? I used it before for shopping carts and maintaining a conversational state, but since a managed bean will be kept during the user session I can store state there, then…
arg20
  • 4,548
  • 1
  • 45
  • 70
8
votes
1 answer

In wildlfy9, how to make stateful ejb session replication with two node in standalone mode(Clustering)

I want to do clustering with ear project. I found one solution to run standalone in clustering using standalone-ha.xml configuration. I followed below article. It's working fine. Clustering in domain mode with wildfly9 But I want to run ERP project…
8
votes
3 answers

Java EE 6: How to call Stateful Session Bean from Stateless Session Bean?

I have a Stateful Session Bean (SFSB) which acts as authentication module. In the SFSB I store the current user that is logged in. Moreover I have some facades (which are Stateless Session Beans (SLSB)) that handles the JPA/SQL stuff for my…
salocinx
  • 3,455
  • 6
  • 53
  • 99
7
votes
1 answer

How does a stateful session bean regain state when client comes back?

If the stateful session bean is going to passivate, its state is written to harddisk and then the bean instance will be freed to serve other request (at least this is my understanding). When the same client is active again, bean instance will read…
Bhushan
  • 16,055
  • 24
  • 96
  • 132
7
votes
2 answers

Should a stateful session bean implements Serializable

I have a simple question but i can't find a answer for Java EE 6! Should a stateful session bean implements Serializable or not? I tested with and without implementing java.io.Serializable and there is no different and no errors. My feeling tells…
Gatschet
  • 1,048
  • 17
  • 36
7
votes
2 answers

When is the stateful session bean destroyed?

I am new to ejbs and I want to know whether a stateful session bean will be destroyed or not. I injected a stateful session bean in my servlet. Even after 30min I see that the bean is active. I am using jboss eap 6.0. I believe that HttpSession has…
Krishna Chaitanya
  • 2,199
  • 3
  • 31
  • 56
6
votes
2 answers

MockMVC Integrate test controller with session scoped bean

I am trying to integrate test a Spring Controller method that uses a spring session scoped bean which is injected into the controller. In order for my test to pass I must be able to access my session bean to set some values on it before I make my…
6
votes
2 answers

JPA Entity found by find in a stateful ejb extended is not managed

I thought that an entity found by em.find was automatically managed by em, even out a transaction, but this class below seems to show the contrary. Was I wrong or what is the mistake in that…
user1643352
  • 2,163
  • 2
  • 16
  • 24
5
votes
2 answers

EJB 3: Accessing a stateful session bean from an application client

I am having some trouble accessing a stateful session bean (SFSB) from an application client. I am using JBoss 5.0.1.GA. The application client and the EJBs are both packaged in an EAR which deploys and I have other application clients which work…
Simon Lehmann
  • 9,924
  • 4
  • 39
  • 52
5
votes
2 answers

Stateful EJB and same session being replicated across clients

I have a stateful EJB that I am using to keep current user information within my application. This EJB is injected into the servlet controller and used to store the last user logged in. However, the session seems to be the same on every single…
FAtBalloon
  • 4,280
  • 1
  • 22
  • 33
5
votes
3 answers

Why shouldn't I use a JSF SessionScoped bean for logic?

I'm developing a java EE web app using JSF with a shopping cart style process, so I want to collect user input over a number of pages and then do something with it. I was thinking to use an EJB 3 stateful session bean for this, but my research leads…
PiersyP
  • 4,353
  • 2
  • 28
  • 32
5
votes
2 answers

Inject Singleton Session Bean into a Stateless Session Bean

Is it allowed (and good practice) to hold some shared informations in our application by using a Singleton Session Bean inside a Stateless Session Bean? The SSB will be injected into the SLSB. @Stateless public class MySLSB { @Inject MySSB…
Gatschet
  • 1,048
  • 17
  • 36
1
2 3 4 5 6 7 8