|
1. Should synchronization primitives be used on bean methods? Answer: No.The EJB specification specifically states that the enterprise bean is not allowed to use thread primitives.The container is responsible for managing concurrent access to beans at runtime. 2. What is the advantage of putting an Entity Bean instance from the "Ready State" to "Pooled state"? Answer: The idea of the "Pooled State" is to allow a container to maintain a pool of entity beans that has been created, but has not been yet "synchronized" or assigned to an EJBObject.This mean that the instances do represent entity beans, but they can be used only for serving Home methods (create or findBy), since those methods do not relay on the specific values of the bean.All these instances are, in fact, exactly the same, so, they do not have meaningful state.Jon Thorarinsson has also added: It can be looked at it this way: If no client is using an entity bean of a particular type there is no need for cachig it (the data is persisted in the database).Therefore, in such cases, the container will, after some time, move the entity bean from the "Ready State" to the "Pooled state" to save memory.Then, to save additional memory, the container may begin moving entity beans from the "Pooled State" to the "Does Not Exist State", because even though the bean's cache has been cleared, the bean still takes up some memory just being in the "Pooled State". 3. Is it possible to write two EJB's that share the same Remote and Home interfaces, and have different bean classes? if so, what are the advantages/disadvantages? Answer: It's certainly possible.In fact, there's an example that ships with the Inprise Application Server of an Account interface with separate implementations for CheckingAccount and SavingsAccount, one of which was CMP and one of which was BMP. 4. Can the primary key in the entity bean be a Java primitive type such as int? Answer: The primary key can't be a primitive type-use the primitive wrapper classes, instead.For example, you can use java.lang.Integer as the primary key class, but not int (it has to be a class, not a primitive) 5. Does RMI-IIOP support dynamic downloading of classes? Answer: No, RMI-IIOP doesn't support dynamic downloading of the classes as it is done with CORBA in DII (Dynamic Interface Invocation).Actually RMI-IIOP combines the usability of Java Remote Method Invocation (RMI) with the interoperability of the Internet Inter-ORB Protocol (IIOP).So in order to attain this interoperability between RMI and CORBA,some of the features that are supported by RMI but not CORBA and vice versa are eliminated from the RMI-IIOP specification. 6. What is the role of serialization in EJB? Answer: A big part of EJB is that it is a framework for underlying RMI: remote method invocation.You're invoking methods remotely from JVM space 'A' on objects which are in JVM space 'B' - possibly running on another machine on the network.To make this happen, all arguments of each method call must have their current state plucked out of JVM 'A' memory, flattened into a byte stream which can be sent over a TCP/IP network connection, and then deserialized for reincarnation on the other end in JVM 'B' where the actual method call takes place.If the method has a return value, it is serialized up for streaming back to JVM A.Thus the requirement that all EJB methods arguments and return values must be serializable.The easiest way to do this is to make sure all your classes. implement.java.io.Serializable. 7. What is EJB QL? Answer: 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 persistenceand 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. 8. What are transaction attributes? Answer: 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. 9. What are the basic classes required in the client for invoking an EJB? Answer: The home and the remote interfaces, the implementation of the Naming Context Factory, the stubs and skeletons.In some App servers the stubs and the skeletons can be dynamically downloaded from the server 10. What are the benefits of Clustering and workload management? Answer: ThE benefits of Clustering and workload management are: - It balances client processing requests, allowing incoming work requests to be distributed according to a configured Workload Management selection policy.
- It provides fail over capability by redirecting client requests to a running server when one or more servers are unavailable.This improves the availability of applications and administrative services.
- It enables systems to be scaled up to serve a higher client load than provided by the basic configuration.With server groups and clones additional instances of servers can easily be added to the configuration.
- It enables servers to be transparently maintained and upgraded while applications remain available for users.
- It centralizes administration of application servers and other objects.
|