7 Replies Latest reply on Mar 4, 2003 10:21 AM by Simone

    Autogenerated PK and Transactions

    Simone Newbie

      Hi,

      I have an entity bean with an auto generated pk MDSId. I have this code inside a session bean facade (with Transaction type required) for an Entity Bean :
      try
      {
      home = this.getMDSKeyVectorLocalHome();
      MDSKeyVectorLocal mdsKeyLocal =
      home.createWithMandatoryParameters(className,
      currency,
      instance,
      process);
      return mdsKeyLocal.getMDSKeyVectorValue();
      }
      MDSKeyVectorLocal has an auto generate key. I tried to put Transaction Attribute to RequiresNew and required for the createMethod but i always get an Exception:
      16:17:56,954 ERROR [LogInterceptor] TransactionRolledbackLocalException, causedBy:
      java.lang.ClassCastException
      at com.db.jbozz.ejb.entity.mds.MDSKeyVectorCMP$Proxy.getMDSId()
      at com.db.jbozz.ejb.entity.mds.MDSKeyVectorCMP.getMDSKeyVectorValue(Unknown Source)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      Any idea?

      Thanks!

      Simone