Migrate enterprise bean code from Version 1.0 to Version 1.1

This information generally applies to any enterprise bean that currently complies with Version 1.0 of the Enterprise JavaBeans (EJB) specification. For more information about migrating code for beans produced with the IBM WebSphere Studio Application Developer tool, see the documentation for that product.

  1. In session beans, replace all uses of javax.jts.UserTransaction with javax.transaction.UserTransaction. Entity beans may no longer use the UserTransaction interface at all.
  2. In finder methods for entity beans, include FinderException in the throws clause.
  3. Remove throws of java.rmi.RemoteException; throw javax.ejb.EJBException instead. However, continue to include RemoteException in the throws clause of home and remote interfaces as required by the use of Remote Method Invocation (RMI).
  4. Remove uses of the finalize() method.
  5. Replace calls to getCallerIdentity() with calls to getCallerPrincipal(). The use of getCallerIdentity() is deprecated.
  6. Replace calls to isCallerInRole(Identity) with calls to isCallerInRole (String).
  7. The use of isCallerInRole(Identity) and java.security.Identity is deprecated. Replace calls to getEnvironment() in favor of JNDI lookup. As an example, change this code:
    String homeName =
       aLink.getEntityContext().getEnvironment().getProperty("TARGET_HOME_NAME");
    if (homeName == null) homeName = "TARGET_HOME_NAME";
    The updated code would look something like this:
    Context env = (Context)(new InitialContext()).lookup("java:comp/env");
    String homeName = (String)env.lookup("ejb10-properties/TARGET_HOME_NAME");
  8. In ejbCreate methods for an entity bean with container-managed persistence (CMP), return the bean's primary key class instead of void.
  9. Add the getHomeHandle() method to home interfaces.
    public javax.ejb.HomeHandle getHomeHandle() {return null;}