I ran into same situation.I was not able to access functions written in 
orientdb through java api but I found solution.Here is a piece of code that 
worked very well.

ODatabaseDocumentTx db = new 
ODatabaseDocumentTx("remote:localhost/test").open("admin", "admin");Integer 
result = db.command(new OCommandFunction("testfunc")).execute(1,2);


But I am still wondering the below code should have worked because the same 
has given in orientdb doc.
ODatabaseDocumentTx odbTx = oPartitionedDatabasePool.acquire();
OFunction function = odbTx.getMetadata().getFunctionLibrary().getFunction(
"functionName");
Number result = (Number)function.execute(userId);

Need clarity on this.

On Monday, 21 September 2015 14:32:41 UTC+5:30, Mihai Ocneanu wrote:
>
> Hello,
>
> I'm trying to run a JS function from within the java API, like so:
>
> ODatabaseDocumentTx odbTx = oPartitionedDatabasePool.acquire();
> OFunction function = odbTx.getMetadata().getFunctionLibrary().getFunction(
> "functionName");
> Number result = (Number)function.execute(userId);
>
> The trouble is 
> odbTx.getMetadata().getFunctionLibrary()
> gives me an empty function library.
>
> Of course, I can access and run the functions from within studio without 
> any issues.
>
> Any idea what I'm doing wrong?
>
> Thanks,
> Mihai
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to