Search in sources :

Example 1 with OObjectNotDetachedException

use of com.orientechnologies.orient.object.db.OObjectNotDetachedException in project orientdb by orientechnologies.

the class OObjectSerializerHelper method getObjectVersion.

public static int getObjectVersion(final Object iPojo) {
    getClassFields(iPojo.getClass());
    final Field idField = fieldVersions.get(iPojo.getClass());
    if (idField != null) {
        final Object ver = getFieldValue(iPojo, idField.getName());
        return convertVersion(ver);
    }
    throw new OObjectNotDetachedException("Cannot retrieve the object's VERSION for '" + iPojo + "' because has not been detached");
}
Also used : Field(java.lang.reflect.Field) OObjectNotDetachedException(com.orientechnologies.orient.object.db.OObjectNotDetachedException) ODatabaseObject(com.orientechnologies.orient.core.db.object.ODatabaseObject)

Aggregations

ODatabaseObject (com.orientechnologies.orient.core.db.object.ODatabaseObject)1 OObjectNotDetachedException (com.orientechnologies.orient.object.db.OObjectNotDetachedException)1 Field (java.lang.reflect.Field)1