Closed luigidellaquila closed 10 years ago
Hi, just use following methods com.tinkerpop.blueprints.impls.orient.OrientElement#getRecord to get underlying record (you can close connections after that) instead of properties you can use fields.
And then you can just call graph.getVertex(record) to attach it and save.
On Wed, Jan 29, 2014 at 5:24 PM, luigidellaquila notifications@github.comwrote:
Hi, implementing CRUD applications, in may cases the user creates a new (temporary) vertex and stores temporary information on it, until he decides to save the vertex and make it persistent. A lot of time can spend from the creation to the save, so I think it's not a good practice to keep the database connection open. I would like to be able to reattach a vertex to a new connection, different from the one I used to create the temporary vertex.
Eg.
//create connection "db" Vertex v = db.addTemporaryVertex("MyClass"); db.shutdown(); //do your operations on v ... //after some minutes //create a new connection "db2" v.attach(db2); v.save(); db2.commit();
— Reply to this email directly or view it on GitHubhttps://github.com/orientechnologies/orientdb/issues/2007 .
Best regards, Andrey Lomakin.
Orient Technologies the Company behind OrientDB
Letting the developer to work with 2 APIs is not so good. We should find an elegant way to let the user to work with Graph Element in detach mode. This is very common on Web Apps. My idea is:
OrientElement detached = graph.detach( OrientElement );
The detached instance could be used offline, until the attach is called:
OrientElement attached = graph.attach( OrientElement );
Makes sense?
Agree :-)
Hi, implementing CRUD applications, in may cases the user creates a new (temporary) vertex and stores temporary information on it, until he decides to save the vertex and make it persistent. A lot of time can spend from the creation to the save, so I think it's not a good practice to keep the database connection open. I would like to be able to reattach a vertex to a new connection, different from the one I used to create the temporary vertex.
Eg.
//create connection "db" Vertex v = db.addTemporaryVertex("MyClass"); db.shutdown(); //do your operations on v ... //after some minutes //create a new connection "db2" v.attach(db2); v.save(); db2.commit();