EJB

EJB Projects

EJB Project 1

EJB Examples

EJB EXAMPLE

EJB Subjective Questions And Answers
More interview questions and answers

Must my bean-managed persistence mechanism use the WebLogic JTS driver?

BEA recommend that we use the TxDataSource for bean-managed persistence. 

Do EJBs have to be homogeneously deployed across a cluster? Why?

Yes EJB\'s have to be homogeneously deployed across a cluster, Its in Beginning with WebLogic Server version 6.0, EJBs must be homogeneously deployed across a cluster for the following reasons :

To keep clustering EJBs simple
To avoid cross server calls which results in more efficiency. If EJBs are not deployed on all servers, cross server calls are much more likely.
To ensure that every EJB is available locally
To ensure that all classes are loaded in an undeployable way
Every server must have access to each EJB\'s classes so that it can be bound into the local JNDI tree. If only a subset of the servers deploys the bean, the other servers will have to load the bean\'s classes in their respective system classpaths which makes it impossible to undeploy the beans.

What is the need of Remote and Home interface. Why cant it be in one?

The main reason is because there is a clear division of roles and responsibilities between the two interfaces. The home interface is your way to communicate with the container, that is who is responsible of creating, locating even removing one or more beans. The remote interface is your link to the bean, that will allow you to remotely access to all its methods and members. As you can see there are two distinct elements (the container and the beans) and you need two different interfaces for accessing to both of them. 

What is architecture of EJB?

Session beans: Session beans are non-persistent enterprise beans. They can be stateful or stateless. A stateful session bean acts on behalf of a single client and maintains client-specific session information (called conversational state) across multiple method calls and transactions. It exists for the duration of a single client/server session. A stateless session bean, by comparison, does not maintain any conversational state. Stateless session beans are pooled by their container to handle multiple requests from multiple clients. Entity beans: Entity beans are enterprise beans that contain persistent data and that can be saved in various persistent data stores. Each entity bean carries its own identity.

Entity beans that manage their own persistence are called bean-managed persistence (BMP) entity beans. Entity beans that delegate their persistence to their EJB container are called container-managed persistence (CMP) entity beans. Message-driven beans: Message-driven beans are enterprise beans that receive and process JMS messages. Unlike session or entity beans, message-driven beans have no interfaces. 

They can be accessed only through messaging and they do not maintain any conversational state. Message-driven beans allow asynchronous communication between the queue and the listener, and provide separation between message processing and business logic. Remote client viewThe remote client view specification is only available in EJB 2.0. The remote client view of an enterprise bean is location independent. 

A client running in the same JVM as a bean instance uses the same API to access the bean as a client running in a different JVM on the same or different machine.Remote interface: The remote interface specifies the remote business methods that a client can call on an enterprise bean. Remote home interface: The remote home interface specifies the methods used by remote clients for locating, creating, and removing instances of enterprise bean classes. Local client viewThe local client view specification is only available in EJB 2.0. Unlike the remote client view, the local client view of a bean is location dependent. Local client view access to an enterprise bean requires both the local cleint and the enterprise bean that provides the local client view to be in the same JVM. The local client view therefore does not provide the location transparency provided by the remote client view. Local interfaces and local home interfaces provide support for lightweight access from enterprise bean that are local clients. Session and entity beans can be tightly couple with their clients, allowing access without the overhead typically associated with remote method calls.Local interface: The local interface is a lightweight version of the remote interface, but for local clients. It includes business logic methods that can be called by a local client. Local home interface: The local home interface specifies the methods used by local clients for locating, creating, and removing instances of enterprise bean classes. EJB client JAR fileAn EJB client JAR file is an optional JAR file that can contain all the class files that a client program needs to use the client view of the enterprise beans that are contained in the EJB JAR file. If you decide not to create a client JAR file for an EJB module, all of the client interface classes will be in the EJB JAR file.EJB containerAn EJB container is a run-time environment that manages one or more enterprise beans. The EJB container manages the life cycles of enterprise bean objects, coordinates distributed transactions, and implements object security. Generally, each EJB container is provided by an EJB server and contains a set of enterprise beans that run on the server.Deployment descriptorA deployment descriptor is an XML file packaged with the enterprise beans in an EJB JAR file or an EAR file. It contains metadata describing the contents and structure of the enterprise beans, and runtime transaction and security information for the EJB container.EJB serverAn EJB server is a high-level process or application that provides a run-time environment to support the execution of server applications that use enterprise beans. An EJB server provides a JNDI-accessible naming service, manages and coordinates the allocation of resources to client applications, provides access to system resources, and provides a transaction service.

What are different type of Java Bean?

What is the difference between Container-Managed Persistent (CMP) Bean and Bean-Managed Persistent(BMP)?

CMP -- Container-managed persistence beans are the simplest for the bean developer to create and the most difficult for the EJB server to support. This is because all the logic for synchronizing the bean\'s state with the database is handled automatically by the container. This means that the bean developer doesn\'t need to write any data access logic, while the EJB server is supposed to take care of all the persistence needs automatically. With CMP, the container manages the persistence of the entity bean.

 Vendor tools are used to map the entity fields to the database and absolutely no database access code is written in the bean class. BMP--bean-managed persistence (BMP) enterprise bean manages synchronizing its state with the database as directed by the container.

The bean uses a database API to read and write its fields to the database, but the container tells it when to do each synchronization operation and manages the transactions for the bean automatically. Bean-managed persistence gives the bean developer the flexibility to perform persistence operations that are too complicated for the container or to use a data source that is not supported by the container.

What is Container-Managed Persistent (CMP) Bean and Bean-Managed Persistent(BMP)?

CMP -- Container-managed persistence beans are the simplest for the bean developer to create and the most difficult for the EJB server to support. This is because all the logic for synchronizing the bean\'s state with the database is handled automatically by the container. This means that the bean developer doesn\'t need to write any data access logic, while the EJB server is supposed to take care of all the persistence needs automatically. With CMP, the container manages the persistence of the entity bean. 

Vendor tools are used to map the entity fields to the database and absolutely no database access code is written in the bean class BMP--bean-managed persistence (BMP) enterprise bean manages synchronizing its state with the database as directed by the container. 

The bean uses a database API to read and write its fields to the database, but the container tells it when to do each synchronization operation and manages the transactions for the bean automatically. Bean-managed persistence gives the bean developer the flexibility to perform persistence operations that are too complicated for the container or to use a data source that is not supported by the container.

What is Entity Bean?

Entity beans:Entity beans are enterprise beans that contain persistent data and that can be saved in various persistent data stores. Each entity bean carries its own identity. 

Entity beans that manage their own persistence are called bean-managed persistence (BMP) entity beans. Entity beans that delegate their persistence to their EJB container are called container-managed persistence (CMP) entity beans.

What are the methods of Entity Bean?

1. setEntityContext() 

2. ejbCreate() 

3. unsetEntityContext()

4. ejbActivate() 

5. ejbPassivate()

6. ejbRemove() 

7. ejbPostCreate() 



What is an EJB Context?

EJBContext is an interface that is implemented by the container, and it is also a part of the bean-container contract. Entity beans use a subclass of EJBContext called EntityContext. Session beans use a subclass called SessionContext.

These EJBContext objects provide the bean class with information about its container, the client using the bean and the bean itself. They also provide other functions. See the API docs and the spec for more details.

How EJB Invocation happens?

Step 1: Using JNDI, retrieve Home Object reference from Naming Service

Step 2: Send or return Home Object reference to the client.

Step 3: Create a new EJB Object through Home Object interface.

Step 4: Create EJB Object from the Ebb Object

Step 5: Send or return EJB Object reference to the client.

Step 6: Invoke business method using EJB Object reference.

Step 7: Delegate request to Enterprise Bean.




Steps to EJB invocation are:


Retrieve Home Object reference from Naming Service via JNDI.

Return Home Object reference to the client.

Create a new EJB Object through Home Object interface.

Create EJB Object from the EJB Object.

Return EJB Object reference to the client.

Invoke business method using EJB Object reference.

Delegate request to Bean (Enterprise Bean).

What are the callback methods in Entity beans?

The bean class implements a set of callback methods that allow the container to notify the events in its life cycle. 

The call back methods available in Entity Bean are public void 

setEntityContext(); 

public void unsetEntityContext(); 

public void ejbLoad(); 

public void ejbStore(); 

public void ejbActivate(); 

public void ejbPassivate(); 

public void ejbRemove();


Can Entity Beans have no create() methods?

Entity Beans have no create() method, when entity bean is not used to store the data in the database. In this case entity bean is used to retrieve the data from database.

But it\'s using the no create() method so we say that \"Yes\", In some cases the data is inserted NOT using Java application, so you may only need to retrieve the information, perform its processing, but not create your own information of this kind.

What is bean managed transaction?

bean-managed transactions, the bean specifies transaction demarcations using methods in the javax.transaction.UserTransaction interface. 

Bean-managed transactions include any stateful or stateless session beans with a transaction-type set to Bean. Entity beans cannot use bean-managed transactions.For stateless session beans, the entering and exiting transaction contexts must match.

For stateful session beans, the entering and exiting transaction contexts may or may not match. If they do not match, the WebLogic Enterprise EJB container maintains associations between the bean and the nonterminated transaction.Session beans with bean-managed transactions cannot use the setRollbackOnly and getRollbackOnly methods of the javax.ejb.EJBContext interface.

What are transaction attributes?

The transaction attribute is a value associated with a method of a session or entity bean\'s home or component interface or with the onMessage(...) method of a message-driven bean.

And the transaction attribute specifies how the Container must manage transactions for a method when a client invokes the method via the enterprise bean\'s home or component interface or when the method is invoked as the result of the arrival of a JMS message. 

Enterprise JavaBeans defines the following (SIX) values for the transaction attribute:NotSupportedRequiredSupportsRequiresNewMandatoryNever

What are transaction isolation levels in EJB?

Transaction_serializable- All the transactions for resource are performed serial.

Transaction_read_uncommitted- Allows a method to read uncommitted data from a DB.Transaction_repeatable_read - Guarantees that all reads of the database will be the same during the transaction.Transaction_read_committed- Guarantees that the data you are getting has been committed.

What is the difference between EJB2.1 and EJB3.0?

No need of Home Interface (EJBHome),but it is needed in EJB2.0No more confusions to make an EJB remote or local,it\'s the client which would decide and cast to appropriate. 

Just write SINGLE simple Java class and annotate it to be Stateless/Stateful/Entity/MessageDriven.ContainerNo Deployment Descriptors , MetaData Annotations are explored which is introduced in J2SE5.0Forget all EJB life cycles.For example Entity bean life cycle in 3.0 is new,managed,detached,removed.

Ejb 3.0 siplifies the developement of the applicationReady to develop complex query,inner/outer join with EJB3.0.The main difference lies in the persistence In case of EJB 3.0 there is JPA Java persistence API which makes the mapping of EntityBeans with the database easy with the help of a service called as EntityManager.

How many types of session beans are?

1.statefull beans
2.stateless beans

What is Session Bean?

Is it possible to share an HttpSession between a JSP and EJB? How?

You can pass the HttpSession as parameter to an EJB method, only if all objects in session are serializable. This has to be consider as passed-by-value, that means that it?s read-only in the EJB. If anything is altered from inside the EJB, it won?t be reflected back to the HttpSession of the Servlet Container.The pass-by-reference can be used between EJBs Remote Interfaces, as they are remote references.While it is possible to pass an HttpSession as a parameter to an EJB object, it is considered to be bad practice in terms of object-oriented design. 

This is because you are creating an unnecessary coupling between back-end objects (EJBs) and front-end objects (HttpSession). Create a higher-level of abstraction for your EJBs API. Rather than passing the whole, fat, HttpSession (which carries with it a bunch of http semantics), create a class that acts as a value object (or structure) that holds all the data you need to pass back and forth between front-end/back-end. Consider the case where your EJB needs to support a non HTTP-based client. This higher level of abstraction will be flexible enough to support it.

What happens when I change a value in the HttpSession from inside an EJB?

You can pass the HttpSession as parameter to an EJB method, only if all objects in session are serializable.This has to be consider as ?passed-by-value\", that means that it?s read-only in the EJB. If anything is altered from inside the EJB, it won?t be reflected back to the HttpSession of the Servlet Container.

The ?pass-by-reference? can be used between EJBs Remote Interfaces, as they are remote references. While it IS possible to pass an HttpSession as a parameter to an EJB object, it is considered to be ?bad practice ? in terms of object oriented design. This is because you are creating an unnecessary coupling between back-end objects (ejbs) and front-end objects (HttpSession). Create a higher-level of abstraction for your ejb?s api.

Rather than passing the whole, fat, HttpSession (which carries with it a bunch of http semantics), create a class that acts as a value object (or structure) that holds all the data you need to pass back and forth between front-end/back-end. Consider the case where your ejb needs to support a non-http-based client. This higher level of abstraction will be flexible enough to support it.

Explain EJB container , EJBHome and EJBObject classes?

EJB containerAn EJB container is a run-time environment that manages one or more enterprise beans. The EJB container manages the life cycles of enterprise bean objects, coordinates distributed transactions, and implements object security. 

Generally, each EJB container is provided by an EJB server and contains a set of enterprise beans that run on the server.EJB Home:When you write the source code for the EJB Home Interface, you must extend the interface EJBHome, and provide method signatures for all the desired create() and find() methods. An object that implements the Home Interface is automatically generated by the EJB Server tools.EJB Object:The \"EJB Object\", or Remote Object, is actually a Wrapper. 

It sits somewhere inside the container, between the client and your code. It is responsible for performing all the setup and shutdown tasks (like opening transactions, or restoring data state) immediately before and after your enterprise bean is called. 

 The \"EJB Object\" is generated by the EJB Server tools -- you don\'t have to write any part of it. However, you do have to write another interface, called the \"Remote Interface\" or the \"EJBObject Interface,\" that extends interface EJBObject, and provides method signatures for all the business methods. The server automatically generates a Java class that implements the Remote Interface; it is this object that is registered with RMI, and a reference to it is returned by the Home Interface (which we now know is actually a Factory Object).

Can the primary key in the entity bean be a Java primitive type such as int?

The primary key can\'t be a primitive type--use theprimitive wrapper classes, instead. 

For example, you can usejava.lang.Integer as the primary key class, but not int (ithas to be a class, not a primitive)

Can you control when passivation occurs?

The developer, according to the specification, cannot directly control when passivation occurs. Although for Stateful Session Beans, the container cannot passivate an instance that is inside a transaction. So using transactions can be a a strategy to control passivation. 

The ejbPassivate() method is called during passivation, so the developer has control over what to do during this exercise and can implement the require optimized logic. Some EJB containers, such as BEA WebLogic, provide the ability to tune the container to minimize passivation calls. Taken from the WebLogic 6.0 DTD -The passivation-strategy can be either default or transaction. With the default setting the container will attempt to keep a working set of beans in the cache. With the transaction setting, the container will passivate the bean after every transaction (or method call for a non-transactional invocation).

What is the advantage of using Entity bean for database operations, over directly using JDBC API to do database operations? When would I use one over the other?

What are the advantages of using an Entity Bean for databaseoperations over directly using JDBC API to do the same?

When would I need to use one over the other?

What is EJB QL?

EJB QL is a Query Language provided for navigation across a network of enterprise beans and dependent objects defined by means of container managed persistence.

EJB QL is introduced in the EJB 2.0 specification. The EJB QL query language defines finder methods for entity beans with container managed persistence and is portable across containers and persistence managers. EJB QL is used for queries of two types of finder methods: 

Finder methods that are defined in the home interface of an entity bean and which return entity objects. Select methods, which are not exposed to the client, but which are used by the Bean Provider to select persistent values that are maintained by the Persistence Manager or to select entity objects that are related to the entity bean on which the query is defined.

Brief description about local interfaces in EJB?

Local interface: The local interface is a lightweight version of the remote interface, but for local clients. It includes business logic methods that can be called by a local client. 

Local home interface: The local home interface specifies the methods used by local clients for locating, creating, and removing instances of enterprise bean classes.

What are the special design cares that must be taken when you work with local interfaces?

It is important to understand that the calling semantics of local interfaces are different from those of remote interfaces. 

For example, remote interfaces pass parameters using call-by-value semantics, while local interfaces use call-by-reference.This means that in order to use local interfaces safely, application developers need to carefully consider potential deployment scenarios up front, then decide which interfaces can be local and which remote, and finally, develop the application code with these choices in mind. 

While EJB 2.0 local interfaces are extremely useful in some situations, the long-term costs of these choices, especially when changing requirements and component reuse are taken into account, need to be factored into the design decision.

What happens if remove ( ) is never invoked on a session bean?

Two situations need to be taken under consideration:


1.remove() invoked for a stateless session:

In this case it may not matter whether we use remove() or not as in either case, nothing is done. The management of the number of beans in cache is done by container.

2.remove() invoked for a stateful session:

Here, 

1. the bean might be kept in cache until the session is timed out after which it is removed or 

2. when there is memory requirement, the data is cached and bean is sent to free pool.    

What is the difference between Message Driven Beans and Stateless Session beans?

The dynamic creation and allocation of message-driven bean instances mimics the behavior of stateless session EJB instances, which exist only for the duration of a particular method call.However, message-driven beans are different from stateless session EJBs (and other types of EJBs) in several significant ways:

Message-driven beans process multiple JMS messages asynchronously, rather than processing a serialized sequence of method calls.Message-driven beans have no home or remote interface, and therefore cannot be directly accessed by internal or external clients. 

Clients interact with message-driven beans only indirectly, by sending a message to a JMS Queue or Topic. Only the container directly interacts with a message-driven bean by creating bean instances and passing JMS messages to those instances as necessary. The Container maintains the entire lifecycle of a message-driven bean; instances cannot be created or removed as a result of client requests or other API calls.

How can I call one EJB from inside of another EJB?

One EJB can be called from another EJB by using JNDI to locate the Home Interface of the other bean, then acquire Remote Interface reference by calling ejbCreate() of the 

Home interface of another bean and then with Remote Interface we can call any Business Method of another EJB.

The EJB container implements the EJBHome and EJBObject classes. For every request from a unique client, does the container create a separate instance of the generated EJBHome and EJBObject classes.Explain it.

The EJB container maintains an instance pool. The container uses these instances for the EJB Home reference irrespective of the client request. 

While referring the EJB Object classes the container creates a separate instance for each client request. The instance pool maintenance is up to the implementation of the container. If the container provides one, it is available otherwise it is not mandatory for the provider to implement it. 

Having said that, yes most of the container providers implement the pooling functionality to increase the performance of the application server. The way it is implemented is again up to the implementer.

Explain EJB Deployment Process.

What is session fa�ade?

A session façade is an EJB design pattern in which a session bean is works like a wrapper over entity beans. A client does not have a direct access to Entity beans but through session beans only for reducing network overhead. 

Usually stateless session beans are used as single access point for the clients but stateful session beans can also be used for the same purpose. 

A layer of session beans exposed to clients to access not only gives a clean approach towards client access to bean components but also reduce network calls so as to make the whole system of high performance.

What is Session Synchronization in EJB?

SessionSynchronization - it\'s purpose is to notify the bean about important moments in its transactional life so that the bean can synchronize the state that it is maintaining on behalf of the client with the database. 

For example, when the transaction begins (afterBegin), the bean can load its state variables with data from the database to be used for the whole transaction, when the transaction is about to complete (beforeCompletion), it can update the database with the state of its variables and after the transaction completes (afterCompletion), it can do what ever it needs to bring its state variables to sync with the database, for example, if the transaction rolled back, it might have to reset its state variables with the old data to bring it in sync with the database. Hence, you are basically using the bean as a poor-man\'s entity bean.

If it is a stateless session bean, it does not have any client-specific state right? Then what will you synchronize? So stateless session beans cannot implement SessionSynchronization because they do not maintain any client-specific state in the first place that would need synchronization.

Entity bean is an abstract class and their local and home interface also extends an abstracts class?

It is important to understand that the calling semantics of local interfaces are different from those of remote interfaces.

For example, remote interfaces pass parameters using call-by-value semantics, while local interfaces use call-by-reference.This means that in order to use local interfaces safely, application developers need to carefully consider potential deployment scenarios up front, then decide which interfaces can be local and which remote, and finally, develop the application code with these choices in mind. 

While EJB 2.0 local interfaces are extremely useful in some situations, the long-term costs of these choices, especially when changing requirements and component reuse are taken into account, need to be factored into the design decision.

How do you throw EJB and SQL exceptions to front-end/presentation layer?

Inside the EJB code you put a try catch block. 

Inside the catch block you throw new EJBException. In the method signature also you declare that the method will thow the exception and not handle it. 

At the client side(assuming there is a Front-end/presentation layer), you put the code which invokes an EJB business method inside try catch block and here there will be a matching RemoteException handler. Within the RemoteException handler you can handle the Exception.

What is the difference between ejbstore and ejbload?

ejbLoad method: This method is called when it is necessary to synchronize the bean with data from the database. This will most likely trigger a SELECT to occur. The ejbLoad is triggered when the client requests to use the bean, forcing activation to happen, thus moving it to the ready pool.  ejbStore method: 

This method is called when it is necessary to synchronize the bean data with the database. This will most likely trigger an UPDATE to occur. The ejbStore is triggered when the bean is no longer being used by a client, and the container decides to move the ready instance back into the pooled state.nullejbLoad method:ejbStore method:

Explain Distributed Object using RMI-IIOP.

RMI-IIOP, developed jointly by IBM and Sun, is a new version of Remote Method Invocation RMI for IIOP (Internet Inter-ORB Protocol) that combines RMI\'s easy programming features with CORBA\'s interoperability.RMI and CORBA have developed independently as distributed-objects programming models. RMI is a Java-based, easy-to-use programming model for distributed objects. 

CORBA (the Common Object Request Broker Architecture), defined by the OMG (Object Management Group), is a well-known distributed-object programming model that supports a number of languages. The IIOP protocol connects CORBA products from different vendors, ensuring interoperability among them. 

RMI-IIOP is a mating of RMI and CORBA, models which have historically not been capable of communicating with each other. For example, RMI\'s native protocol, JRMP (Java Remote Method Protocol), cannot connect with other protocols.

What problems you faced while deploying ejb's in weblogic Jarfiles to be build in EJB 2.0?

Do we need to use isIdentical() for Local Interfaces or isEqual() would serve the purpose?

Is possible for an EJB client to marshal an object of class java.lang.Class to an EJB?

Is it legal to have static initializer blocks in EJB?

Is it possible to stop the execution of a method before completion in a SessionBean?

What is the default transaction attribute for an EJB?

Is there any default cache management system with Entity beans ? In other words whether a cache of the data in database will be maintained in EJB ?

Why is ejbFindByPrimaryKey mandatory?

Why do we have a remove method in both EJBHome and EJBObject?

What is the difference between a Server, a Container, and a Connector?

How is persistence implemented in enterprise beans

Is method overloading allowed in EJB?Give Exmapls

Should synchronization primitives be used on bean methods?

Are we allowed to change the transaction isolation property in middle of a transaction?

For Entity Beans, What happens to an instance field not mapped to any persistent storage, when the bean is passivated?

What is a Message Driven Bean?

What functions does a message driven bean have?How do they work in collaboration with JMS?

Does RMI-IIOP support code downloading for Java objects sent by value across an IIOP connection in the same way as RMI does across a JRMP connection?

Why we are not keeping Ejb class file in war?

Without home and remote interfaces cant we implement ejb?

What are webservices?

How many clients can share a same instance of a stateful session bean?

Why stateless session beans contain only one create() method and statefull session bean contain more than one create() methods?

How to call ejbs from jsp?

Is the ejbCreate() method is compulsorry in stateless session beans, statefull session beans and entity.

If i call remove() method on remote object, what happen?

What is "reentrant"?

What is EJBDoclet?

What is the difference between a “Coarse Grained” Entity Bean and a “Fine Grained” Entity Bean?

What is IIOP?

How do I know what the developer named the bean?

Does each stateless session bean have its own EJBObject?

Why don't stateful session beans have a pool?

How can a stateful bean be scalable if you always need one bean for every client?

How long does a stateful bean keep client-specific state?

How and when does the container create the EJBObject and the Home and the stubs?

Who makes the EJBObject class?

What happens when an interface extends another interface?

What happens if the client object and the remote object are running in different JVMs, but on the same physical machine?

Which are features in EJB 2.0 ? and which are features in EJB 3.0?

Is stateful session beans are scalable?

What is the difference between EJB and J2EE?

Without using entity beans can we do database transactions?

What is the difference between EJB and RMI?

Already we have http session in servlets. so why we use session beans ejb?

What is meant by Serialization and Externalization? Serialization is a Marker interface,so what is the use of WriteObject() anf ReadObject(), Where it is actually used? Give me some real time examples?

What is the use of using session facade design pattern in EJB'S?

Why java is system independent?

What is static block?

When we use abstract class and interface?

How we deploy in weblogic?

When are transaction propagated webcomponet(servlet,jsp) to EjbComponent?

What is ejbdoc?

Where is JNDI located (In client or server).If its server, how a client can get the information about which EJB is registered in JNDI?

How EJB will be registered in JNDI?

How to achieve clustering and connection pooling in ejb?

What are EJB?

What are factors to determine which type of the EJBs to use?

Describe how transactions are handled in EJB.

What happens to an EJB if an Exception is not caught?

How to configure the jdbc driver in welogic server?

What are all the necessary jar files to be used?

How EjbQL ara impemented when it is necessary?

What do you mean by shared transactional state data?

What do you mean by EJB client?

What is a message Driven java bean?

What is specific advantage of jsp on client side for web based development?

Can we deploy two ejbs with same JNDI name in separate EAR?

What is default state of session bean?

What is return type of create method of an entity bean?

When should we use session bean/entity bean?

What is the importance of the Narrow class in RMI?

Just by seeing the signature of the bean how can you specify whether it is a Stateful or Stateless Session Bean?

How EjbQL are implemented when it is necessary?

Why we need the transactions?

What is Business Delegate?

Give a scenario where you have used stateless session beans and why was it necessary?

What are the call back methods in Session bean?

Why BMP class returns null & why CMP implementation class reurns instanceof PK class?

What do you mean by shared transactional state data maintained by EJB?

What is Session Bean?

What are the various types of Session Bean?

What is the difference between normal Java object and EJB?

How to insert new row and link like Edit and Delete?

Can a Session Bean be defined without ejbCreate() method?

What do you mean by CMP & BMP &what is basic difference between them?

What is difference between connector, server, and container?

What is session synchronization in EJB?

What is the use of activate, passivate methods in EJB?

What kind of bean(entity/session) will you use if there are no database transactions and all you use is a read-only database.

What is the default transaction attribute in transactions?

Can we use session beans & entity beans in single application?

When we are writing bean class in session beans, we are not implementing home interface and remote interface, then how can we provide the implementation for the methods in both the interfaces?

If something you’re passing to a remote method isn't Serilizable , is this a compile-time or runtime failure?

Why can't you just use the equals() method instead of isIdentical()? isn't that what equals() is for?

Why can't you serialize the stub? Why do we need handles?

How to invoke servlet from ejb components?

How Non Java Client access EJB?

Can I use session beans and hibernate (instead of entity beans) for persistence?

What is the need of two Objects i.e EJBHome object and EJBobject to access a bean?

How to make a call to ejb a local instead of remote and what is the role of session facade in this procedure?

Is the ejbCreate() method is compulsorry in stateless session beans, statefull session beans and entity beans?

ejb-jar.xml and weblogic-ejb-jar.xml explian it.

Why we use this in the deployment descriptor? Explain with an example.

Is there any way to read values from an entity bean without locking it for the rest of the transaction (e.g. read-only transactions)?

What happens when I change a value in the HttpSession from inside an EJB?

You can pass the HttpSession as parameter to an EJB method, only if all objects in session are serialize.This has to be consider as ?passed-by-value\", that means that it?s read-only in the EJB. 

If anything is altered from inside the EJB, it won?t be reflected back to the HttpSession of the Servlet Container.The \"pass-by-reference\" can be used between EJBs Remote Interfaces, as they are remote references.

While it IS possible to pass an HttpSession as a parameter to an EJB object, it is considered to be \"bad practice\" in terms of object oriented design.

This is because you are creating an unnecessary coupling between back-end objects (ejbs) and front-end objects (HttpSession).

Create a higher-level of abstraction for your ejb\'s api. Rather than passing the whole, fat, HttpSession (which carries with it a bunch of http semantics), create a class that acts as a value object (or structure) that holds all the data you need to pass back and forth between front-end/back-end.

Consider the case where your ejb needs to support a non-http-based client. This higher level of abstraction will be flexible enough to support it.

Is it possible to share an HttpSession between a JSP and EJB?

You can pass the HttpSession as parameter to an EJB method, only if all objects in session are serialize.

This has to be consider as \"passed-by-value\", that means that it\'s read-only in the EJB. If anything is altered from inside the EJB, it won\'t be reflected back to the HttpSession of the Servlet Container.

The \"pass-by-reference\" can be used between EJBs Remote Interfaces, as they are remote references.

What is the advantage of putting an Entity Bean instance from the “Ready State” to “Pooled state”?

The EJB container implements the EJBHome and EJBObject classes. For every request from a unique client, does the container create a separate instance of the generated EJBHome and EJBObject classes?

Entity bean is an abstract class and their local and home interface also extends an abstracts class.

what are Container-Managed Transactional attributes ?