EJB Interview Questions and Answers
Question - 11 : - What is a Server Group?
Answer - 11 : - A server group is a template of an Application Server(and its contents) i.e, it is a logical representation of the application server. It has the same structure and attributes as the real Application Server, but it is not associated with any node, and does not correspond to any real server process running on any node.
Question - 12 : - What is the new basic requirement for a CMP entity bean class in 2.0 from that of ejb 1.1?
Answer - 12 : - It must be abstract class. The container extends it and implements methods which are required for managing the relationships
Question - 13 : - What’s new in the EJB 2.0 specification?
Answer - 13 : - Following are some of the main features supported in EJB 2.0:
1. Integration of EJB with JMS,
2. Message Driven Beans,
3. Implement additional Business methods in Home interface which are not specific for bean instance, EJB QL.
Question - 14 : - How can I access EJB from ASP?
Answer - 14 : - We can use the Java 2 Platform, Enterprise Edition Client Access Services (J2EETM CAS) COM Bridge 1.0, currently downloadable from Sun
Question - 15 : - What is the relationship between local interfaces and container-managed relationships?
Answer - 15 : - Entity beans that have container-managed relationships with other entity beans, must be accessed in the same local scope as those related beans, and therefore typically provide a local client view. In order to be the target of a container-managed relationship, an entity bean with container-managed persistence must provide a local interface.
Question - 16 : - Are enterprise beans allowed to use Thread.sleep()?
Answer - 16 : - Enterprise beans make use of the services provided by the EJB container, such as life-cycle management. To avoid conflicts with these services, enterprise beans are restricted from performing certain operations: Managing or synchronizing threads
Question - 17 : - What is the difference between a Coarse Grained Entity Bean and a Fine Grained Entity Bean?
Answer - 17 : - A ‘fine grained’ entity bean is directly mapped to one relational table, in third normal form. A ‘coarse grained’ entity bean is larger and more complex, either because its attributes include values or lists from other tables, or because it ‘owns’ one or more sets of dependent objects. Note that the coarse grained bean might be mapped to a single table or flat file, but that single table is going to be pretty ugly, with data copied from other tables, repeated field groups, columns that are dependent on non-key fields, etc. Fine grained entities are generally considered a liability in large systems because they will tend to increase the load on several of the EJB server’s subsystems (there will be more objects exported through the distribution layer, more objects participating in transactions, more skeletons in memory, more EJB Objects in memory, etc.)
Question - 18 : - What is EJBDoclet?
Answer - 18 : - EJBDoclet is an open source JavaDoc doclet that generates a lot of the EJB related source files from custom JavaDoc comments tags embedded in the EJB source file.
Question - 19 : - What is the difference between session and entity beans?
Answer - 19 : - An entity bean represents persistent global data from the database; a session bean represents transient user-specific data that will die when the user disconnects (ends his session). Generally, the session beans implement business methods (e.g. Bank.transferFunds) that call entity beans (e.g. Account.deposit, Account.withdraw)
Question - 20 : - Is it legal to have static initializer blocks in EJB?
Answer - 20 : - Although technically it is legal, static initializer blocks are used to execute some piece of code before executing any constructor or method while instantiating a class. Static initializer blocks are also typically used to initialize static fields - which may be illegal in EJB if they are read/write - In EJB this can be achieved by including the code in either the ejbCreate(), setSessionContext() or setEntityContext() methods