aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes EJB3 over multiple forms Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB3 over multiple forms" Watch "EJB3 over multiple forms" New topic
Author

EJB3 over multiple forms

Rashid Limbada
Greenhorn

Joined: Aug 17, 2007
Posts: 7
HI

I am currently using ejb3 in my action class. My problem is that I have a form which spans over multiple pages. All pages of the form call the same action. I am using a stateful session bean in my action class but the bean gets reset every time the action gets called. How can I stop the bean from initialising every time the action is called. I thought that stateful session beans hold state and that if you perform a jndi lookup on the bean, it will retuen an existing bean if it exists of course. I have not removed my bean so I expected the JNDI to find my active bean.

Could I possibly pass the bean into the request. If so then is it not easier for me to use DTO's.

Thanks
Scott Selikoff
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3716
    
    5

You could store the bean as a session object if the amount of data it holds is not too big or number of users too great. Granted, stateful beans should maintain there information so long as you do not remove/terminate them so its probably a programming issue.

Keep in mind, stateless session beans are *FAR MORE* useful in practice than stateful because of their element of reusability. For large enough systems, stateless session beans are used in conjunction with session objects and database-managed sessions. The fact that methods in a stateful session bean may have preconditions before they can be called makes them very difficult to reuse internally.
[ October 15, 2007: Message edited by: Scott Selikoff ]

My Blog: Down Home Country Coding with Scott Selikoff
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB3 over multiple forms