Maybe there is an alternative but you can get ODatabaseDocumentTx  also 
from  OrientGraphFactory:

OrientGraphFactory graphFactory = new OrientGraphFactory(url, dbUser, 
dbPsw);    
graphFactory.setupPool(1, 10);
graphFactory.getDatabase(); // ODatabaseDocumentTx
graphFactory.getTx(); // OrientGraph
graphFactory.getNoTx(); // OrientGraphNoTx



Dne pátek 18. září 2015 15:25:25 UTC+2 Mihai Ocneanu napsal(a):
>
> Hello,
>
> I have this simple code: 
> ODatabaseDocumentTx db = new ODatabaseDocumentTx("SERVER_URL").open(
> "USER_LOGIN","USER_PASS");
> List<ODocument> result = db.query( new OSQLSynchQuery<ODocument>("select 
> * from V_User "));
> ...
>
> Which works as far as the query is concerned, but, I get this error:
>
> org.codehaus.jackson.map.JsonMappingException: Database instance is not 
>> set in current thread. Assure to set it with: 
>> ODatabaseRecordThreadLocal.INSTANCE.set(db); (through reference chain:  
>> com.orientechnologies.orient.core.record.impl.ODocument["locked"])
>>
>
> The solution - I think - is to use the pooled connection factory, but I 
> can't figure it out.
>
> The documentation <http://orientdb.com/docs/last/Document-Database.html>
> states:
>
> // OPEN THE DATABASE
> ODatabaseDocumentTx db = 
> ODatabaseDocumentPool.global().acquire("remote:localhost/petshop", "admin", 
> "admin");
> try {
>   // YOUR CODE
>   ...
> } finally {
>   db.close();
> }
>
>
> BUT ODatabaseDocumentPool is deprecated. link 
> <https://github.com/orientechnologies/orientdb/issues/3524> 
>
> How am I supposed to initialize the factory and get an instance?
>
> 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