stateful-session-bean

Why use stateful session beans?

烈酒焚心 提交于 2019-12-01 02:54:13
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 when to use SFSB. I see only problems with it, because we should learn something about it, we should write code which consists of annotations a bit less then completely, we should use annoying lookup ... and we don't get anything good in return. For example, we can't use SFSB from SLSB, because stateful objects can be used only from stateful context.

Why use stateful session beans?

孤者浪人 提交于 2019-11-30 22:56:12
问题 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 when to use SFSB. I see only problems with it, because we should learn something about it, we should write code which consists of annotations a bit less then completely, we should use annoying lookup ... and we don't get anything good in return. For

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

会有一股神秘感。 提交于 2019-11-30 14:14:35
问题 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 me to believe that a SFSB is not tied to a client's http session, so I would have to manually keep track of it via an httpSession, some side questions here . . . 1) Why is it called a session bean, as far as I can see it has nothing to do with a

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

纵然是瞬间 提交于 2019-11-30 09:27:05
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 entities. In order to check the access permissions of the current user, I try to call the SFSB out of the SLSB. But the current user field is always "null" when called from SLSB. When calling the SFSB directly, the current user field is set correctly... For calling I use the @EJB annotation. Any ideas what the problem might be? Is that somehow a context

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

邮差的信 提交于 2019-11-29 15:07:37
问题 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 entities. In order to check the access permissions of the current user, I try to call the SFSB out of the SLSB. But the current user field is always "null" when called from SLSB. When calling the SFSB directly, the current user field is set correctly...

When to use Stateful session bean over Stateless session bean?

孤街醉人 提交于 2019-11-28 02:48:54
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 session. Because the client interacts (“talks”) with its bean, this state is often called the conversational state. A stateless session bean is defined as follows: Stateless Session Beans A stateless session bean does not maintain a conversational state with the client. When a client invokes the methods of a stateless bean, the bean’s instance variables may

access existing instance stateful inside stateless, java ee 6

淺唱寂寞╮ 提交于 2019-11-27 22:34:56
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 OfferManagerBean implements OfferManagerLocal, OfferManager { @Resource private SessionContext context; @EJB private ro.project.ejb.interfaces.User user; public String getUsername() { user = (ro.project.ejb.interfaces.User) context.lookup("java:global/project/projectEJB/User!ro.project.ejb.interfaces.User"); return user.getUsername(); } Client side User

When to use Stateful session bean over Stateless session bean?

强颜欢笑 提交于 2019-11-26 23:48:45
问题 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 session. Because the client interacts (“talks”) with its bean, this state is often called the conversational state. A stateless session bean is defined as follows: Stateless Session Beans A stateless session bean does not maintain a conversational state with

access existing instance stateful inside stateless, java ee 6

你离开我真会死。 提交于 2019-11-26 21:08:26
问题 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 OfferManagerBean implements OfferManagerLocal, OfferManager { @Resource private SessionContext context; @EJB private ro.project.ejb.interfaces.User user; public String getUsername() { user = (ro.project.ejb.interfaces.User) context.lookup("java:global