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…
Setting Read more…
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.
Create the bean interface and mark it either as @Remote or @Local. Stateful cannot have web service client view.
Create a class which implements the business interface. Mark this class as Read more…
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 ""; }