Sunday, January 11, 2009

what's new in ejb3

Features of EJB3:
There are various simplifications made in EJB3 like:
1.No need of home and object interfaces
2.No need of any component interfaces
3.Made use of java annotations
4.Simplifies APIs.
Elimaination of Home and Remote Interfaces:

The session bean contains all the business methnew fileods inside a business interface.A message driven bean doesnot need to include the business interface a there is no direct interaction of the client with message driven bean.

Elimination of component interfaces:
The bean provider can implement a seperate bean class that consists of all the callback notification methods that inform the container to treat it as a listener class.The second way is that,bean provider can implement the notification method inside the bean class and designate this method to handle the corresponding events.In both the cases bean class uses annotations.Annotations are additional key features of EJB3 specifications.

Simplified Acess To Environment:
EJB3 also includes the features like lookup method on the EJBContest and dependency injection to acess the bean's dependencies.

Dependency Injection:
Dependency injection is the mechanism through which the container injects the requested environmental entry to make available to the bean instance before any bean instance is invoked on that particular instance.Then the container injects these entries into bean variable or methods.

EJB context:
Bean must know about its environmental at runtime such as security principle,transcation context in which its method is invoked and so on.

Interceptors:
An intecept is method is used to intercept a business method invocation.Stateless session beans and message driven beans may includes the interceptors.We can also define an interceptor class insted of defining interceptor methods in the bean class.

Simple JNDI lookup of EJB:
Lookup of the EJB has been simplified so that the client can directly invoke methods on EJB rather than creating the bean instance simply by invoking create method on EJB.

Annotations:
Sun Microsystem added the features like annotations to make the development easier.Annotations behave like the meta.This leads to a declarative programming style where the programmer says what should be done and tools emit the code to do it.
Annotations is the way of associating the program elements with the meta tags so that compiler can extract program behavior to support the annotated elements to generate inredependent code when necessary.

No comments: