I see. So what would be the best approach to copy the ID of the vertex just created into another property named UUID ?
On Tuesday, May 20, 2014 1:29:39 AM UTC-7, Artem Orobets wrote: > > Hi Amit, > > An explicit call toString() may brake your graph consistency. > > You are doing the changes in transaction so ids of the elements are > temporary and will be updated during transaction commit. Explicit call > toString will prevent such update. > > This also mean that you need to commit transaction before serialization. > > As for the json result, I'm not sure that it is a bug in Orient, looks > like it is a bug in GraphSONWriter. Could you create a bug > report<https://github.com/orientechnologies/orientdb/issues/new>to check that? > > > Best regards, > Artem Orobets > > *Orient Technologies the Company behind OrientDB* > > > 2014-05-20 9:50 GMT+03:00 Amit Kumar <alla...@gmail.com <javascript:>>: > >> An explicit toString() call on getId() resolves this BTW. >> >> e.g. >> >> v.setProperty("uuid", v.getId().toString()); - this works for the >> expected result. But I am not sure if that should be explicitly done ? >> >> >> On Monday, May 19, 2014 11:44:58 PM UTC-7, Amit Kumar wrote: >>> >>> Dear Experts, >>> >>> I seem to have an issue with JSON serialization of a property that was >>> created after copying id of a vertex/edge from OrientGraph into another >>> property on the same vertex/edge say UUID. >>> >>> Here is a sample code.... >>> >>> public static void main(String[] args) throws IOException { >>> >>> Graph g = new OrientGraph("plocal:/users/home/orientdb-community-1.7- >>> rc1/databases/test","admin", "admin"); >>> >>> Vertex v = g.addVertex(null); >>> v.setProperty("uuid", v.getId()); >>> String graphJsonResult; >>> try (ByteArrayOutputStream os = new ByteArrayOutputStream()) { >>> >>> GraphSONWriter.outputGraph(g, os, GraphSONMode.NORMAL); >>> >>> graphJsonResult = os.toString("UTF-8"); >>> System.out.println(graphJsonResult); >>> } >>> >>> } >>> >>> Result:{"mode":"NORMAL","vertices":[{"uuid":"V#9:-2{uuid:#9:-2} v0", >>> "_id":"#9:-2","_type":"vertex"}],"edges":[]} >>> >>> Expected: {"mode":"NORMAL","vertices":[{"uuid":"#9:-2","_id":"#9:-2"," >>> _type":"vertex"}],"edges":[]} >>> >> -- >> >> --- >> 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 orient-databa...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- --- 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 orient-database+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.