Network Deployment (Distributed operating systems), v8.0 > Reference > Developer detailed usage information


Container-managed persistence restrictions and exceptions

Some external software that directly impact the applications can limit container-managed persistence (CMP) features. However, you can work around these limitations.

In each case, only very specific behaviors of the software place restrictions on your CMP beans. The following tips help you prevent these behaviors.


CMP deployment and Sybase IMAGE type restriction

When deploying enterprise beans with container managed persistence (CMP) types that are non-primitive and do not have a natural JDBC mapping, the deployment tool maps the CMP type to a binary type in the database, where it is stored as a serialized instance. For Sybase, the tool uses the JDBC type LONG VARBINARY. The Sybase driver maps LONG VARBINARY to the native type IMAGE.

Although the type VARBINARY has fewer restrictions than IMAGE in Sybase, you cannot use it because it is limited to a size of 255 bytes, which is too small for typical serialized Java objects.

The specific restrictions on the IMAGE type are:

To work around this restriction, edit the EJB mappings in the Rational Application Developer toolset and do either of the following:


A ClassCastException exception occurs when running CMP 1.1 beans

If you created your EJB application using Rational Application Developer or WebSphere Studio Application Developer Integration Edition, v4.0.x , and the application contains container managed persistence (CMP) 1.1 beans with associations (relationships), you might receive a java.lang.ClassCastException exception when you run the application on WAS.

Deprecated feature: Business processes modeled with WebSphere Studio Application Developer Integration Edition Version 5.0 or earlier are deprecated.depfeat

The cast operation generated by Rational Application Developer or WebSphere Studio Application Developer Integration Edition, v4.0.x, does not use the javax.rmi.PortableRemoteObject.narrow(...) object to convert the remote object to the remote interface of CMP beans in the XToYLink.java (or YToXLink.java) class where X and Y are CMP 1.1 beans.

Recommended response

  1. Locate the following methods in all link classes, for example, XToYLink.java and YToXLink.java where X and Y are CMP 1.1 beans:
    public void secondaryAddElementCounterLinkOf(javax.ejb.EJBObject anEJB)
    public void secondaryRemoveElementCounterLinkOf(javax.ejb.EJBObject anEJB)
    public void secondarySetCounterLinkOf(javax.ejb.EJBObject anEJB)
    

  2. Add the javax.rmi.PortableRemoteObject.narrow(...) object to convert the remote object to the remote interface of CMP beans.

For example, change the following original method:

public void secondaryAddElementCounterLinkOf(javax.ejb.EJBObject anEJB) throws java.rmi.RemoteException {
        if (anEJB != null)
               ((X) anEJB).secondaryAddY((Y) getEntityContext().getEJBObject());
to:
public void secondaryAddElementCounterLinkOf(javax.ejb.EJBObject anEJB) throws java.rmi.RemoteException {
        if (anEJB != null)
             ((X) anEJB).secondaryAddY((Y)
javax.rmi.PortableRemoteObject.narrow(getEntityContext().getEJBObject(), Y.class));


Related


Container managed persistence bean associated technologies

+

Search Tips   |   Advanced Search