In this example, I have followed a one-to-one unidirectional relationship to
AddressEntity type.  I seem to get a valid reference, but when I proceed to
execute a method (AddressEntity.getId() in this case), I get
NoSuchObjectException.  The second time, it works correctly and I do not get
an exception.

        Nested exception is:
java.rmi.NoSuchObjectException: com.indnet.common.model.base.EntityKey@49d
        at
AddressEntityHome_EntityHomeWrapper734.findExistingEntity(AddressEntityHome_
EntityHomeWrapper734.java:40)
        at
AddressEntity_EntityBeanWrapper28.reActivate(AddressEntity_EntityBeanWrapper
28.java:3163)
        at
AddressEntity_EntityBeanWrapper28.getId(AddressEntity_EntityBeanWrapper28.ja
va:395)
        at
com.indnet.symbiosis.service.common.address.ServiceAddressHelper.getValue(Se
rviceAddressHelper.java:43)
        at
com.indnet.symbiosis.service.companymanagement.CompanyManagementServiceBean.
getValue(CompanyManagementServiceBean.java:685)
        at
com.indnet.symbiosis.service.companymanagement.CompanyManagementServiceBean.
getValue(CompanyManagementServiceBean.java:661)
        at
com.indnet.symbiosis.service.companymanagement.CompanyManagementServiceBean.
findContactByAliasLogin(CompanyManagementServiceBean.java:244)
        at
CompanyManagementService_StatelessSessionBeanWrapper2.findContactByAliasLogi
n(CompanyManagementService_StatelessSessionBeanWrapper2.java:2389)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.evermind.server.rmi.bd.dr(JAX)
        at com.evermind.util.f.run(JAX)
at connection to localhost/127.0.0.1
        at com.evermind.server.rmi.OrionRemoteException.ib(JAX)
        at com.evermind.server.rmi.bb.h4(JAX)
        at com.evermind.server.rmi.bb.run(JAX)
        at java.lang.Thread.run(Thread.java:484)

I have done some more investigation, and it seems to have to do with the
finder I execute.  The first function always works correctly, the second
function fails the first time (with above exception) and then proceeds to
work correctly.  If I call the first function, followed by the second, then
everything works fine.  It's like something is "dirty" and then gets set
correctly.

  public Contact findContactById(final Long contactId) throws
RemoteException, NamingException, FinderException, FieldException {
    return
      getValue(
        ContactEntityHomeFinder.getHome().findByPrimaryKey(new
EntityKey(contactId))
      );
  }

  public Contact findContactByAliasLogin(final String alias, final String
login) throws RemoteException, NamingException, FinderException,
FieldException {
    return
      getValue(
        ContactEntityHomeFinder.getHome().findByAliasLogin(alias, login)
      );
  }

The actual lines of code that fails is:

  public static Address getValue(final AddressEntity entity) throws
RemoteException, FieldException {
    Address value = null;
    if (entity != null) {
      value = new Address();
      value.set(Address.FIELD_ID, entity.getId()); //<<-- this line fails
    }
    return value;
  }


Does any one have any ideas?

Thanks.
-AP_


Reply via email to