Search in sources :

Example 1 with OTransactionNoTx

use of com.orientechnologies.orient.core.tx.OTransactionNoTx in project orientdb by orientechnologies.

the class OObjectDatabaseTx method deleteRecord.

private boolean deleteRecord(ORID iRID, final int iVersion, boolean prohibitTombstones) {
    checkOpeness();
    if (iRID == null)
        return true;
    ODocument record = iRID.getRecord();
    if (record != null) {
        Object iPojo = getUserObjectByRecord(record, null);
        deleteCascade(record);
        if (prohibitTombstones)
            underlying.cleanOutRecord(iRID, iVersion);
        else
            underlying.delete(iRID, iVersion);
        if (getTransaction() instanceof OTransactionNoTx)
            unregisterPojo(iPojo, record);
    }
    return false;
}
Also used : ODatabaseObject(com.orientechnologies.orient.core.db.object.ODatabaseObject) ProxyObject(javassist.util.proxy.ProxyObject) OMetadataObject(com.orientechnologies.orient.object.metadata.OMetadataObject) ODocument(com.orientechnologies.orient.core.record.impl.ODocument) OTransactionNoTx(com.orientechnologies.orient.core.tx.OTransactionNoTx)

Example 2 with OTransactionNoTx

use of com.orientechnologies.orient.core.tx.OTransactionNoTx in project orientdb by orientechnologies.

the class OObjectDatabaseTx method delete.

@Override
public ODatabaseObject delete(final ORID iRID) {
    checkOpeness();
    if (iRID == null)
        return this;
    final ORecord record = iRID.getRecord();
    if (record instanceof ODocument) {
        Object iPojo = getUserObjectByRecord(record, null);
        deleteCascade((ODocument) record);
        underlying.delete(record);
        if (getTransaction() instanceof OTransactionNoTx)
            unregisterPojo(iPojo, (ODocument) record);
    }
    return this;
}
Also used : ORecord(com.orientechnologies.orient.core.record.ORecord) ODatabaseObject(com.orientechnologies.orient.core.db.object.ODatabaseObject) ProxyObject(javassist.util.proxy.ProxyObject) OMetadataObject(com.orientechnologies.orient.object.metadata.OMetadataObject) ODocument(com.orientechnologies.orient.core.record.impl.ODocument) OTransactionNoTx(com.orientechnologies.orient.core.tx.OTransactionNoTx)

Example 3 with OTransactionNoTx

use of com.orientechnologies.orient.core.tx.OTransactionNoTx in project orientdb by orientechnologies.

the class OObjectDatabaseTx method delete.

public ODatabaseObject delete(final Object iPojo) {
    checkOpeness();
    if (iPojo == null)
        return this;
    ODocument record = getRecordByUserObject(iPojo, false);
    if (record == null) {
        final ORecordId rid = OObjectSerializerHelper.getObjectID(this, iPojo);
        if (rid == null)
            throw new OObjectNotDetachedException("Cannot retrieve the object's ID for '" + iPojo + "' because has not been detached");
        record = (ODocument) underlying.load(rid);
    }
    deleteCascade(record);
    underlying.delete(record);
    if (getTransaction() instanceof OTransactionNoTx)
        unregisterPojo(iPojo, record);
    return this;
}
Also used : ORecordId(com.orientechnologies.orient.core.id.ORecordId) ODocument(com.orientechnologies.orient.core.record.impl.ODocument) OTransactionNoTx(com.orientechnologies.orient.core.tx.OTransactionNoTx)

Aggregations

ODocument (com.orientechnologies.orient.core.record.impl.ODocument)3 OTransactionNoTx (com.orientechnologies.orient.core.tx.OTransactionNoTx)3 ODatabaseObject (com.orientechnologies.orient.core.db.object.ODatabaseObject)2 OMetadataObject (com.orientechnologies.orient.object.metadata.OMetadataObject)2 ProxyObject (javassist.util.proxy.ProxyObject)2 ORecordId (com.orientechnologies.orient.core.id.ORecordId)1 ORecord (com.orientechnologies.orient.core.record.ORecord)1