public void setUserName(String name) {
ODatabaseDocumentTx db = new ODatabaseDocumentTx("remote:localhost/demo").open("demo", "demo")
db.command(new OCommandSQL("update User set name=?")).execute(name);
db.close();
}
But this seems hardly the best way. What's the idiomatic way of handling connections in OrientDB?
Thanks,
Erik
Btw, even the documentation, as listed here: http://orientdb.com/docs/2.0/orientdb.wiki/Document-Database.html, still recommends using the deprecated ODatabaseDocumentPool.global() code. Is this correct?
pool = new OPartitionedDatabasePool(getUrl(), getUsername(), getPassword(), getMaxPoolSize());
public ODatabaseDocumentTx openDatabase() {
return pool.acquire();
}
Hi /m,Yes, I think that would work, thanks! And when I'm done with the connection, can I just close it (or use an ARM block) ?
OPartitionedDatabasePool oPartitionedDatabasePool = new OPartitionedDatabasePool("x", "x", "y");
ODatabaseDocumentTx acquire1 = oPartitionedDatabasePool.acquire();
But that's returning a ODatabaseDocumentTx, while I need an OObjectDatabaseTx.
The only workaround I've found so far, is to use this:
OPartitionedDatabasePool oPartitionedDatabasePool = new OPartitionedDatabasePool("x", "x", "y");
OObjectDatabaseTx acquire1 = new OObjectDatabaseTx(oPartitionedDatabasePool.acquire());
But it looks like a pretty expensive operation, if I look at the sourcecode. Is this the way to go?
Thanks,
Erik
OObjectDatabaseTx : it should be use for object API.
for Graph API you should use : OrientGraphFactory, OrientGraph
Thanks
Hi /m,I tested this, and it doesn't work :-(I was using this:OObjectDatabaseTx acquire = OObjectDatabasePool.global().acquire();,but it's deprected. Now I have to use this:OPartitionedDatabasePool oPartitionedDatabasePool = new OPartitionedDatabasePool("x", "x", "y");
ODatabaseDocumentTx acquire1 = oPartitionedDatabasePool.acquire();But that's returning a ODatabaseDocumentTx, while I need an OObjectDatabaseTx.
The only workaround I've found so far, is to use this:
OPartitionedDatabasePool oPartitionedDatabasePool = new OPartitionedDatabasePool("x", "x", "y");
OObjectDatabaseTx acquire1 = new OObjectDatabaseTx(oPartitionedDatabasePool.acquire());But it looks like a pretty expensive operation, if I look at the sourcecode. Is this the way to go?
On Sunday, December 27, 2015 at 1:55:55 AM UTC+1, Erik Pragt wrote:Hi /m,I tested this, and it doesn't work :-(I was using this:OObjectDatabaseTx acquire = OObjectDatabasePool.global().acquire();,but it's deprected. Now I have to use this:OPartitionedDatabasePool oPartitionedDatabasePool = new OPartitionedDatabasePool("x", "x", "y");
ODatabaseDocumentTx acquire1 = oPartitionedDatabasePool.acquire();But that's returning a ODatabaseDocumentTx, while I need an OObjectDatabaseTx.
The only workaround I've found so far, is to use this:
OPartitionedDatabasePool oPartitionedDatabasePool = new OPartitionedDatabasePool("x", "x", "y");
OObjectDatabaseTx acquire1 = new OObjectDatabaseTx(oPartitionedDatabasePool.acquire());But it looks like a pretty expensive operation, if I look at the sourcecode. Is this the way to go?I think this is correct usage, at least looking into implementation part of it. OObjectDatabaseTx is documented as a wrapper class and does some initializing (entity manager & object serializer helpers).I believe overhead is not that big.cheers,
On Sunday, December 27, 2015 at 1:55:55 AM UTC+1, Erik Pragt wrote:Hi /m,I tested this, and it doesn't work :-(I was using this:OObjectDatabaseTx acquire = OObjectDatabasePool.global().acquire();,but it's deprected. Now I have to use this:OPartitionedDatabasePool oPartitionedDatabasePool = new OPartitionedDatabasePool("x", "x", "y");
ODatabaseDocumentTx acquire1 = oPartitionedDatabasePool.acquire();But that's returning a ODatabaseDocumentTx, while I need an OObjectDatabaseTx.
The only workaround I've found so far, is to use this:
OPartitionedDatabasePool oPartitionedDatabasePool = new OPartitionedDatabasePool("x", "x", "y");
OObjectDatabaseTx acquire1 = new OObjectDatabaseTx(oPartitionedDatabasePool.acquire());But it looks like a pretty expensive operation, if I look at the sourcecode. Is this the way to go?I think this is correct usage, at least looking into implementation part of it. OObjectDatabaseTx is documented as a wrapper class and does some initializing (entity manager & object serializer helpers).I believe overhead is not that big.cheers,/m