[6 Mar 2012 | No Comment | 2,527 views]
  • Stateless Session Beans are business objects that do not have state associated with them.
  • The @Stateless annotation is used to mark the class as Stateless Session Bean.
  • Access to a single bean instance is still limited to only one client

Read more…

[6 Mar 2012 | No Comment | 2,197 views]

In the following example, we create an AccountBean with two instance variables ‘name’ and ‘balance’. We show that the container assigns the same instance to the client on multiple invocations. The stateful session bean instance is associated with the Read more…

[6 Mar 2012 | No Comment | 6,012 views]

  • A session bean instance’s life starts when a client obtains a reference to a stateful session bean instance through dependency injection or JNDI lookup.
  • Next, the container performs any dependency injection as specified by metadata annotations on the bean

Read more…

[6 Mar 2012 | 7 Comments | 14,350 views]

Environment Used

  • JDK 6 (Java SE 6)
  • EJB 3.x
  • Web Client – Servlet 2.5 API
  • Eclipse Indigo IDE for Java EE Developers (3.7.1)
  • JBoss Tools – Core 3.3.0 M5 for Eclipse Indigo (3.7.1)
  • JBoss Application Server (AS) 7.1.0 Final

Setting Read more…

[6 Mar 2012 | No Comment | 6,978 views]

No-Interface Client View

  • The EJB 3.1 specification addresses no-interface local view.
  • The no-interface view has the same behaviour as the EJB 3.0 local view. However, a no-interface view does not require a separate interface, that is, all public methods of

Read more…

[6 Mar 2012 | No Comment | 5,061 views]

The lifecycle callbacks are methods defined in the bean class but not in business interface which the container calls when specific lifecycle event or transition occurs. The following annotations are used to define lifecycle callbacks on stateful session beans.

@PostConstruct

Read more…

[5 Mar 2012 | No Comment | 1,689 views]

Business Interface

Create the bean interface and mark it either as @Remote or @Local. Stateful cannot have web service client view.

Remote Interface

Local Interface

Bean implementation class

Create a class which implements the business interface. Mark this class as Read more…

[5 Mar 2012 | No Comment | 2,104 views]

The @Stateful annotation is used to mark the class as Stateful Session Bean. This annotation’s specification is as follows.

@Target(value=TYPE) @Retention(value=RUNTIME) public @interface Stateful { String description() default ""; String name() default "<Bean class name>"; String mappedName() default ""; }

Read more…

[5 Mar 2012 | No Comment | 2,128 views]
  • Stateful Session Beans are business objects having state (values of its instance variables)
  • Because the client interacts (“talks”) with its bean, this state is often called the conversational state and represents a unique client/bean session.
  • The @Stateful annotation is used

Read more…

[5 Mar 2012 | No Comment | 1,364 views]
  • A business interface cannot be annotated with more than one access type.
  • For example, an interface HelloWorld cannot have both @Local and @Remote annotations.
  • If we want the bean to provide multiple client views (for eg. both Local and Remote)

Read more…