简体   繁体   中英

Oriendb Select @ rid from table returning -2:0

On Executing the following query in Oriendb(2.1.2),@rid is returning negative rid and actually rid is present in a rid key.Please refer below for the more explanation

Sub Query :

select @rid from actions

OP :

{
    "result": [
        {
            "@type": "d",
            **"@rid": "#-2:0",**
            "@version": 0,
            **"rid": "#12:24",**
            "@fieldTypes": "rid=x"
        }
    ],
    "notification": "Query executed in 0.026 sec. Returned 1 record(s)"
}

Main Query :

INSERT INTO activityDetails SET name = "Dummy",actionMap ={"1":(**select  @rid from action where start is not null**-->Returns a invalid Rid),"2":(select * from action where stop is not null)};

Op:

com.orientechnologies.orient.core.exception.OValidationException: The field 'activityDetails.actionMap' has been declared as LINKMAP but the value is not a record or a record-id

How to substitute rid in place of @rid in subquery?

The negative RID means that is temporary. When the transaction is committed a real RID will be assigned this beacause after the commit the RID is changed and it's updated in the object.

when you make the insert, only one record is returned from the selects? you could do a test by putting in the select "limit 1")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM