EJB Container functionality details
What is EJB: It’s written in Java programming language an enterprise bean is a server-side component that encapsulates business logic of the application. Business logic is the code that fulfills purpose of the application. For an example of stock price application enterprise beans might implement business logic in methods called retrieveStockPrice and getProduct and by invoking these methods at run-time clients can access the stock price provided by the application. Below are the functionality provided by EJB container:
- Dependency injection (DOI): Multiple resources like JPA entity manager, JDBC data-source, logging, security etc. can be injected into EJB
- Transaction management: EJB container can transaction automatically based on configuration before the method of EJB invoked and committed or roll-backed once this method returns. This transnational context is propagated to calls to other EJBs.
- Security management: Check can be made that the caller has necessary roles assigned to execute the method
- Concurrency: Container makes sure application concurrency where only one thread at a time invokes the method of your EJB instance
- Distributed: EJBs can be called remotely from another JVM as well.
Load balancing and fail-over: Remote clients of EJBs can automatically have their call redirected to another server if needed this can be configured easily.
- Resource management: Stateful beans is automatically be passivated to the disk in order to limit the memory consumption of EJB server