Hey Guys,
i'm currently evaluating how to do a database-refactoring mechanism with
orientdb. My Problem is when i rename a property (see attached code) i have
to use the old name for getting the value instead of the new one. From the
"metadata" i just can get the new name, the old would throw an npe.
LOGGER.info("insert data...");
List<String> propertiesList = new ArrayList<String>();
propertiesList.add("name");
propertiesList.add("test");
propertiesList.add("inherited");
propertiesList.add("true");
OrientVertex vertex = graph.addVertex("class:Characteristic" ,
propertiesList.toArray(new Object[propertiesList.size()]));
graph.commit();
LOGGER.info("insert data...done");
LOGGER.info("change property name..."); // TODO by schema import!
graph.getVertexType("Characteristic").getProperty("inherited").setName("valueInherited");
graph.commit();
LOGGER.info("change property name...done");
graph.getRawGraph().getLevel1Cache().clear();
graph.getRawGraph().getLevel2Cache().clear();
OrientVertex vertexFromDb = graph.getVertex(vertex.getId());
System.out.println(vertexFromDb.getPropertyKeys()); // returns [inherited,
name]
System.out.println(graph.getVertexType("Characteristic").getProperty("valueInherited").getName());
// returns valueInherited
//System.out.println(graph.getVertexType("Characteristic").getProperty("inherited").getName());
// this would throw a NPE
assertNotNull("Property 'inherited' not found",
vertexFromDb.getProperty("inherited")); // i would expect this test to fail
because property was renamed but it passes
assertNotNull("Property 'valueInherited' not found",
vertexFromDb.getProperty("valueInherited")); // i would expect this test to
pass, but it fails!
Did i miss anything (e.g. clear anything other than level1 and 2 cache)? If
not is this a bug or the expected behaviour?
best regards
--
---
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.