public void modify(Object obj) {
		if (obj instanceof IPersistent) {
			((IPersistent) obj).modify();
		}
		else {
			if (useSerializableTransactions) {
				ThreadTransactionContext ctx = getTransactionContext();

				if (ctx.nested != 0) { // serializable transaction
					ctx.modified.add(obj);
					return;
				}
			}

			synchronized (this) {
				synchronized (objectCache) {
					synchronized (objMap) {
						ObjectMap.Entry e = objMap.put(obj);

						if ((e.state & Persistent.DIRTY) == 0 && e.oid != 0) {
							if ((e.state & Persistent.RAW) != 0) {
								throw new StorageError(
										StorageError.ACCESS_TO_STUB);
							}

							Assert.that((e.state & Persistent.DELETED) == 0);
							storeObject(obj);
							e.state &= ~Persistent.DIRTY;
						}
					}
				}
			}
		}
	}