public synchronized int makePersistent(Object obj) {
		if (!opened) {
			throw new StorageError(StorageError.STORAGE_NOT_OPENED);
		}

		if (obj == null) {
			return 0;
		}

		int oid = getOid(obj);

		if (oid != 0) {
			return oid;
		}

		if (forceStore
				&& (!useSerializableTransactions || getTransactionContext().nested == 0)) {
			synchronized (objectCache) {
				storeObject0(obj, false);
			}

			return getOid(obj);
		}
		else {
			synchronized (objectCache) {
				oid = allocateId();
				assignOid(obj, oid, false);
				setPos(oid, 0);
				objectCache.put(oid, obj);
				modify(obj);
				return oid;
			}
		}
	}