Saturday, March 10, 2007

What are the services provided by the container?

i. Manages execution and life cycle of EJBs.
ii. May provide transaction services.
iii.Shields clients from lower level network management.
iv. May provide persistent storage.


SOURCE : www.referjava.com

What is scalable, portability in J2EE?

i. Scalable in the sense could handle number of clients at the same time.



ii. Portable - platform independent, app server independent, data store independent.


SOURCE : www.referjava.com

When to use container managed and bean managed persistence?

Container managed persistance is used when the persistant datastore is a

relational database and there is one to one mapping between a data represented in a table in the relational database and the ejb object. Bean managed persistance in used when there is no one to one mapping of the table and a complex query reteriving data from several tables needs to be performed to construct an ejb object. Bean managed is also used when the

persistence datastorage is not a relational database.



SOURCE : www.referjava.com

How is entity bean created using Container managed entity bean ?

In both container managed and bean managed when the client calls create the call is passed on to ejbCreate.



In a container managed bean ejbCreate method will initialize all instance variables based ont he input arguments passed in. Once ejbCreate method completesthe container will automatically persist the bean. ejbCreate would return null.This is because: it is not practially possible to generate a primary key in ejbCreate and it would be impossible to get hold of the primary key for a row in a table even before the row exists as storage happens only after

ejbCreatecall completes.



In a bean managed persistance the ejbCreate will perform the fallowing:

i. Create an entry in the database

ii. Initialize the instance variables

iii. Return the primary key.



SOURCE : www.referjava.com

What are the methods of Entity Bean?

setEntityState

create

ejbCreate

ejbPostCreate

ejbActivate

ejbPassivate

remove

ejbRemove

unsetEntityState


SOURCE : www.referjava.com

Why does EJB needs two interface (Home and Remote Interface) ?

To handle the network tranport layer. TODO I do not have much knowledge to explain further.


SOURCE : www.referjava.com

When to use session, entity and message driven beans?

Session beans are used to represent a business procedure and no persistance

Is required. Session bean represents a client in the server. Entity beans represent a business logic compared procedure. Entity beans are typically shared between several session beans and persist beyond the scope of the application.



Message driven beans are new in j2ee 2.0 and are asynchronous beans typically

used to inteact with legacy batch processing systems.


SOURCE : www.referjava.com