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.

119 questions
5
votes
1 answer

Purposes of @Remove method in stateful EJB

I do understand, that calling a @Remove annotated method will tell the EJB container, that the client do not need the instance of a stateful EJB any longer and that it can be removed after the call. But in the Oracle JEE tutorial this method is used…
stg
  • 2,757
  • 2
  • 28
  • 55
5
votes
1 answer

Lookup returns new instance of Stateful session bean

I am using Java EE 5, EJB 3.0, Jboss AS 4.3.2. I have simplest Stateful bean @Local public interface IStateBean { } @Stateful public class StateBean implements IStateBean { private static int number = 0; @PostConstruct void init() …
Ilya
  • 29,135
  • 19
  • 110
  • 158
4
votes
4 answers

access existing instance stateful inside stateless, java ee 6

Is it possible to access a stateful session bean inside a stateless bean? My problem is that I have a session bean called User and I want to access user info inside a stateless bean... I am trying like this: Ejb Side: @Stateless public class…
Alex
  • 2,126
  • 3
  • 25
  • 47
4
votes
1 answer

LazyInitializationException with CDI Managed Bean and Stateful Session Bean

I have a CDI Managed Bean (a bean annotated with @Named that is used on JSF) that has a Stateful Session Bean injected. This session bean is like a service, it has the entity manager (annotated with @PersistenceContext(type=…
4
votes
0 answers

In wildfly, how do I disable Stateful Bean Passivation without using the EJB3.2-specific "passivationCapable=false"

I have set up cluster. I am using EJB 3.1 in my project. Can I somehow disable Stateful Session Bean passivation?
Marinos An
  • 9,481
  • 6
  • 63
  • 96
4
votes
2 answers

Using both @Stateful and @SessionScoped for shopping cart EJB

I know there's a lot of debate on using stateful vs stateless EJBs in web applications. The shopping cart is the most common use case: Oracle's Java EE examples use it a lot in the official docs, too. Here on stackoverflow I found many interesting…
Fabio B.
  • 9,138
  • 25
  • 105
  • 177
4
votes
2 answers

Why prefer JNDI lookup over EJB injection for a Stateful session bean?

I'm quite new to Java EE and I can't figure out why I should prefer JNDI lookup over injection for a Stateful session bean ? (That's what I read on slide of a lesson about it)
Matthieu Riegler
  • 31,918
  • 20
  • 95
  • 134
4
votes
1 answer

Stateful session beans vs. persistent entities

Stateful session beans are often illustrated by implementing a shopping cart. Coming from outside Java EE, my inclination would be to handle this kind of state with a persistent model entity: a ShoppingCart object with Products and quantities. This…
Daniel Lyons
  • 22,421
  • 2
  • 50
  • 77
4
votes
1 answer

EJB-@Singleton to manage query results

Should I use EJB-@Singleton (javax.ejb.Singleton) for statistics or monitoring or would it be better to cache the statistics in common @SessionScoped-Bean? To clear my question, here are two scenarios: Scenario I: A User begins a Websession and…
3
votes
2 answers

Can SFSB be accessed concurrently by one client?

I know that a Stateful EJB can be accessed concurrently by a particular client. The container is serializing the requests and execute them one after another. The question is - can you set the EJB container to let the concurrent access to the SFSB? I…
Piotr Nowicki
  • 17,914
  • 8
  • 63
  • 82
3
votes
2 answers

How to manage a stateful webservice?

I am trying to learn about J2EE and web services (in GlassFish 3.1). This question is a bit of a follow up to this. I have figured out how to use Stateless Session Beans and the Web Service. I am really only using the Web Service (@WebService) out…
Level9000
  • 73
  • 2
  • 4
3
votes
1 answer

Singleton vs Stateful remote EJB references in clusters

I'm using a vanilla JBossAS 6 server with a couple of projects to test the functionality of clustered JBoss environments. The problem that I have is that if I transfer an EJB reference from one EJB (of another type) in a node, to an instance of the…
3
votes
1 answer

Stateful session bean in Struts2

I have been trying to create a simple stateful session bean with Struts2, but every time I resend my request and try to retrieve the info previously put in my stateful bean, it returns NULL. Am I missing something? The injection is working properly…
TEN
  • 91
  • 2
  • 6
3
votes
2 answers

Stateful session bean multi-threaded access

The EJB 3.2 spec says the following: By default, clients are allowed to make concurrent calls to a stateful session object and the container is required to serialize such concurrent requests. Note that the container never permits multi-threaded …
pepe
  • 814
  • 8
  • 12
2
votes
1 answer

Superfluous SFSB being created in Glassfish, thus leaking memory

I am trying to inject a single SFSB into a ViewScoped JSF backing bean, in Glassfish 3.1.1. My log shows this, which is that TWO SFSBs are created, although only the second gets injected: INFO: constructed a new sfsb:…
Kevin Pauli
  • 8,577
  • 15
  • 49
  • 70