Thursday, February 16, 2012

EJB 3.1 Rocks!

I got an opportunity to explore EJB 3.1 API after a long time. In that juncture i couldn't resist my self to post some of the features of EJB 3.1 API.

Singleton capability - Singleton feature of EJB3.1 allows one session bean instance per JVM. This feature allows concurrent access and it is totally thread safe.

We can access the Singleton bean similarly how we access the stateless session bean as follows.

No-interface view - Before EJB3.1 it is necessary to have an interface for creating a bean, but EJB3.1 api allows us to create beans without an interface which eases developers life.

Asynchronous - Another nice feature of this API, which allows us to invoke session beans asynchronously

There are more features added to EJB 3.1 API.

Tuesday, February 14, 2012

Spring Data Binding

Data Binding happens in spring mvc when it submits a command object from a form. Command objects of any type used to transport data between presentation and controller layers.

When ever data transfers across these layers the core servlet (or servlet api) treats these parameters as string instead of objects of specific type.

Spring data binding enables the user to set the property values on a command object which are entered from a form.

DataBinder uses PropertyEditor (PropertyEditors basically part of Sun JavaBean API) for converting the object to string type and vice versa.

It is a better practice to explicitly register the PropertyEditor in initBinder() method for a particular controller class.

Vaadin integration with spring framework

Vaadin is a new generation framework mainly used to develop web applications. I can say Vaadin is a pure java framework where developers can use minimal or no html & javascript code to build web applications.

Add the following dependencies in pom.xml file to import all the vaadin and spring related library files into your vaadin project.
The main intention to use 'SpringApplicationSevlet' in web.xml is to integrate Spring and Vaadin frameworks. The basic purpose of this servlet is to load all the vaadin related classes.
Spring context listener used to load the spring bean configuration files.

Follow https://vaadin.com to find more information on Vaadin framework.