/** Simulate detching and object and attempting to merge it. */
 public void test() {
   getSession().getIdentityMapAccessor().initializeAllIdentityMaps();
   UnitOfWork uow = getSession().acquireUnitOfWork();
   PhoneNumber detachedPhone = (PhoneNumber) uow.readObject(PhoneNumber.class);
   ((DatabaseValueHolder) detachedPhone.owner).setSession(null);
   uow.release();
   getSession().getIdentityMapAccessor().initializeAllIdentityMaps();
   uow = getSession().acquireUnitOfWork();
   DescriptorException caughtException = null;
   try {
     uow.deepMergeClone(detachedPhone);
   } catch (DescriptorException exception) {
     caughtException = exception;
   }
   if ((caughtException == null)
       || (caughtException.getErrorCode()
           != DescriptorException.ATTEMPT_TO_REGISTER_DEAD_INDIRECTION)) {
     throwError("Incorrect exception thrown. " + caughtException);
   }
   uow.release();
 }
  public void setup() {
    deadlockDetected = false;
    this.getExecutor().swapServerSession();
    UnitOfWork uow = getSession().acquireUnitOfWork();
    person = (ConcurrentPerson) uow.registerObject(new ConcurrentPerson());
    person.name = "SomeoneSpecial";

    project = (ConcurrentLargeProject) uow.registerObject(new ConcurrentLargeProject());
    project.setName("ConcurrentRFJUOWLock Project");

    ConcurrentAddress address = (ConcurrentAddress) uow.registerObject(new ConcurrentAddress());
    address.setStreet("99 Bank St");
    project.setLocation(address);

    uow.commit();
    uow.release();
  }