View RSS Feed

EJB

Enterprise Java Beans

  1. Asynchronous method calls

    by , 11-07-2011 at 06:52 PM (My Java Tips)
    Methods called on the asynchronous proxy will be executed asynchronously, and the results can be obtained later on.


    To execute methods asynchronously in EJB 3.0, one can use asynchronous proxy. This allows calling methods at an instance, and collecting the results later. Good thing is that there exist a JBoss extension to EJB 3.0, which allows obtaining asynchronous proxy from the remote or local interface of a stateful session bean, stateless session bean or service bean.
    ...
    Categories
    EJB
  2. Preparing development environment for J2EE dev/JBoss

    by , 11-06-2011 at 05:25 PM (My Java Tips)
    I will show how to prepare development environment for J2EE development using JBoss. Download and install the JBoss. I will be using jboss-4.2.2.GA. Now download the latest Java EE Eclipse from eclipse.org. I have version 3.3.2.


    You should have all the required plugins for J2EE development with JBoss in your Eclipse. Navigate to:

    Help > Software updates > Find and Install > Search for new features to install > New remote site

    You can name ...
    Categories
    JSF , Eclipse , EJB , Java EE , JBoss
  3. Entity (Tips/Info)

    by , 11-05-2011 at 06:47 PM (My Java Tips)
    In this post, I will present some useful information about Entities. I hope these will prove useful.




    You may indicate the entity class by annotating it with the Entity annotation or you may denote that class as entity in the XML descriptor. The entity class must have no-arg constructor and it should either be public and protected. The entity class can have other constructors as well.

    Another important thing to note about entity class is that the entity ...
    Categories
    EJB
  4. Sample Entity Bean

    by , 11-05-2011 at 06:45 PM (My Java Tips)
    Creating entity bean is simple. You have to annotate the class to indicate that itís an entity bean. Also your class should implement Serializable interface. An example entity bean is presented below. Do note that we have defined a no argument constructor which is a must.




    Java Code:
    @Entity
    public class Customer implements Serializable {
    
    private Long id;
    private String name;
    private Address address;
    private Collection
    ...
    Categories
    EJB
  5. @Stateful (Stateful session bean)

    by , 11-03-2011 at 06:34 PM (My Java Tips)
    @Stateful annotation is used to represent stateful session bean. These beans are used to maintain conversational state across method invocations, then use stateful session beans. As the name implies, these beans maintain the internal state. For instance: Online shopping is an example of stateful session bean. We need to maintain the state of the bean when the customer adds/removes items from the cart.


    An example of stateful session bean is presented below:

    Java Code:
    @Stateful(entityContext=INSTANCE)
    ...
    Categories
    EJB , Java EE
  6. Using @Stateless

    by , 11-03-2011 at 06:25 PM (My Java Tips)
    Stateless session beans are those, who do not keep track of the information that is passed from one method call to another. Thus, they donít have internal state and each invocation of a stateless business method is independent of its previous invocation. These beans are simple to manage for the container. For example: tax calculation is a business task and we can have a bean for that. It will simply calculate the tax for an employee. It can be a stateless session bean since each time we call it, ...
    Categories
    EJB , Java EE