Could anyone tell me the answer of following questions:
1) What is the difference between Session bean and Entity bean?
2) When writing Session bean, what kind of files is necessary?
e.g. Home, interface......
3) What is the usage of Home, Interface, bean?
4) Deployment Descriptor is necessary?
5) What is the usage of Deployment Descriptor?
Re: EJB question
1) There are 2 types of session beans - Stateful & Stateless
You can think of a session bean as an extension of client on a server.
A session bean model is intended for the use of a single client. A session
bean's lifespan should be no longer than that of it's client.
Stateful Session Bean - can keep info on behalf of it's client method
calls (like the shopping cart)
Stateless Session Beran - cannot keep this info, nor does it needs to
(like a calculator bean)
Entity Bean - you can think of Entity bean as an Object orientation
representation of data in a database. Multiple clients can access it.
An entity bean might represent a customer, a product etc.
2) Home interface, Remote interface, Implementation class, Deployment
descriptor (plus any other helper classes)
3) Home Interface - it has method for creating new component instances and/or
finding existing instances of the bean.
Remote Interface - exposes the business methods of the component to it's
4) Yes, it is necessary. The whole purpose of writing EJBs is to use them
and in order to do so, you need deployment descriptor.
5) Deployment Descriptor - is a single XML files per JAR file and holds
info (attributes as tags) about the bean itself ( stateless/stateful,
bean linking etc, home/remote interfaces etc)
Obviously, There's a lot more to EJBs than what's been mentioned here but
I hope that this helps you understand some of the basics.
"VAX" <email@example.com> wrote:
>Could anyone tell me the answer of following questions:
>1) What is the difference between Session bean and Entity bean?
>2) When writing Session bean, what kind of files is necessary?
> e.g. Home, interface......
>3) What is the usage of Home, Interface, bean?
>4) Deployment Descriptor is necessary?
>5) What is the usage of Deployment Descriptor?
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL