Select from parameterized RID (Java API)

Using the Java API if I want to select from a specific RID and want to parameterize the query, using the last option I get an exception:

ODatabaseSession db = ...
db.query("select from v where @rid = #402:83"); //op 1
db.query("select from v where @rid = :rid", "#402:83"); //op 2
db.query("select from #402:83"); //op 3
db.query("select from :rid", "#402:83"); //op 4, exception

Using option 4 the following exception is thrown:

com.orientechnologies.orient.core.exception.OCommandExecutionException: Class not found: #402:83

The thing is that option 2 is very slow. Is this (exception in op 4) a bug?

Hi @johny65

The following is supposed to work fine

db.query("select expand(?)", rid);

but you cannot pass it as a string, you have to instantiate an actual Rid:

db.query("select expand(?)", new ORecordId("#402:83"))



1 Like

@luigidellaquila That works fine, thank you very much.