public void setup() { mapping = (ManyToManyMapping) getSession() .getProject() .getDescriptor(DirectEntityMapHolder.class) .getMappingForAttributeName("directToEntityMap"); oldPrivateOwnedValue = mapping.isPrivateOwned(); mapping.setIsPrivateOwned(usePrivateOwned); UnitOfWork uow = getSession().acquireUnitOfWork(); holder = new DirectEntityMapHolder(); EntityMapValue value = new EntityMapValue(); value.setId(1); holder.addDirectToEntityMapItem(new Integer(11), value); EntityMapValue value2 = new EntityMapValue(); value2.setId(2); holder.addDirectToEntityMapItem(new Integer(22), value2); uow.registerObject(holder); uow.registerObject(value); uow.registerObject(value2); uow.commit(); Object holderForComparison = uow.readObject(holder); if (!compareObjects(holder, holderForComparison)) { throw new TestErrorException("Objects do not match after write"); } getSession().getIdentityMapAccessor().initializeAllIdentityMaps(); }
public void test() { UnitOfWork uow = getSession().acquireUnitOfWork(); changedHolder = (DirectEntityMapHolder) uow.readObject(holder); EntityMapValue value = new EntityMapValue(); value.setId(3); changedHolder.addDirectToEntityMapItem(new Integer(33), value); changedHolder.getDirectToEntityMap().remove(new Integer(11)); uow.commit(); Object holderForComparison = uow.readObject(holder); if (!compareObjects(changedHolder, holderForComparison)) { throw new TestErrorException("Objects do not match after write"); } }