EJB Interview Questions & Answers

Showing 10 of 54 questions | Page 2

Technical interview questions and answers are crucial for clearing an EJB Interview because Enterprise JavaBeans are widely used in enterprise-level, distributed, and transactional applications. Companies evaluate your understanding of session beans, entity beans, message-driven beans, JNDI, lifecycle methods, and container-managed transactions. These concepts often appear in Java developer interviews conducted by TCS, Wipro, Infosys, Cognizant, and Accenture. For freshers and job seekers planning to enter Java-based development roles, EJB forms an important part of backend and enterprise Java interviews. This guide provides the most frequently asked EJB interview questions with answers, explained in simple language to help you understand real-time use cases. Preparing these questions will help you succeed in technical rounds and placement tests focused on Java EE technologies.

Java developers should also master J2EE concepts and explore J2SE fundamentals  for comprehensive enterprise development expertise 

Showing 10 of 54 questions

11. What is the new basic requirement for a CMP entity bean class in 2.0 from that of ejb 1.1?

It must be abstract class. The container extends it and implements methods which are required for managing the relationships

12. whats new in the EJB 2.0 specification?

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.

13. How can I access EJB from ASP?

We can use the Java 2 Platform, Enterprise Edition Client Access Services (J2EETM CAS) COM Bridge 1.0, currently downloadable from Sun

14. What is the relationship between local interfaces and container-managed relationships?

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

15. What is EJBDoclet?

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.

16. What is the difference between session and entity beans?

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)

17. Is it legal to have static initializer blocks in EJB?

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

18. What are transaction isolation levels in EJB?

1. Transaction_read_uncommitted- Allows a method to read uncommitted data from a DB(fast but not wise). 2. Transaction_read_committed- Guarantees that the data you are getting has been committed. 3. Transaction_repeatable_read - Guarantees that all reads of the database will be the same during the transaction (good for read and update operations). 4. Transaction_serializable- All the transactions for resource are performed serial.

19. Can Entity Beans have no create() methods?

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.

20. When should I adopt BMP and when I should use CMP?

You can use CMP and BMP beans in the same application… obviously, a bean can be BMP or CMP, not both at the same time (they are mutually exclusive). There is a common approach that is normally used and considered a good one. You should start developing CMP beans, unless you require some kind of special bean, like multi-tables, that cannot be completely realized with a single bean. Then, when you realize that you need something more or that you would prefer handling the persistence (performanb
Questions and Answers for Competitive Exams Various Entrance Test