# Plain old Java objects

Although POJOs existed before, they play a more important role in the programming methodology of Java™ EE 5. Now, you can now create EJB applications with persistence capabilities by using enterprise beans and entities created from POJOs.

The complexity of the Java 2 Enterprise Edition framework used to present a major hurdle for adoption previously. The Java EE 5 specification sought a simpler development experience by making POJOs the basis of its design paradigm. The POJO programming model enables you to unit test outside of the application server, making the whole programming experience smoother.

#### A simple POJO

The following code is an example of a simple POJO. Note that there are no references to any interfaces. To use this POJO as the basis for an EJB 2.1 application requires additional framework classes to support it and the class itself would have to implement additional interfaces.

    public class Test {

        String name;

    		/**
        *  This is a constructor for a Test Object.
        **/
        public Test(){

            name = "Jane";

        }

    }

To create an EJB 3.0 bean, inject a component defining annotation at the class level. The following example turns a POJO into a stateless session bean by adding the @Stateless annotation.

    @Stateless

    String class Test {

    	String name;

    	/**
    	* This is a constructor for a Test Object.
    	**/
    	public Test () {

    			name = "jane";

    	}

    }

In a real application, the POJO needs additional business logic. The fundamental idea of using POJOs in the context of the Java EE specification is to associate Metadata about your component to be associated directly in your POJO. This approach reduces the number of artifacts you need to deal with and makes it easier to ensure the integrity of your Metadata.
The new POJO-based programming model also shifts your concentration to working on your Java EE 5 components in your Java editor as opposed to writing business logic in XML. By working with this application development software, you can take advantage of features that can even further simplify the process of developing Java EE 5 applications (such as as-you-type validation, content assist, and refactoring).
Parent topic: EJB 3.0 and EJB 3.1 architecture