Hi, I have the same problem, (orientdb-community-1.7-rc1) What if I need to create new Classes (Edge) dynamically? I can't use external scripts, classes are created dynamically based on query results...
/Lux Il giorno lunedì 19 agosto 2013 13:51:24 UTC+2, Lvc@ ha scritto: > > You could create a .SQL script to execute it at the beginning as: > > > ./console.sh script.sql > > This script.sql should contain your schema changes like: > > create database plocal:/temp/db admin admin plocal graph > create class Car extends V > create class Person extends V > ... > > > Lvc@ > > > On 19 August 2013 13:27, Roar <[email protected] <javascript:>> wrote: > >> >> So if I'm not supposed to do that in Java how do recommend that I do it >> then? >> >> /Roar >> >> >> On Monday, August 19, 2013 1:17:43 PM UTC+2, Lvc@ wrote: >> >>> Hi, >>> you should create the schema before to run the apps because schema >>> changes aren't transactional. >>> >>> Lvc@ >>> >>> >>> On 19 August 2013 13:06, Roar <[email protected]> wrote: >>> >>>> Version: orientdb-graphed-1.5.1-SNAPSHOT. >>>> >>>> I'm doing some pretests before moving from 1.3.0 to 1.5.x and this is >>>> the first issue I ran into. >>>> >>>> When creating vertexes like the the documentation shows (using >>>> OrientGraph: https://github.com/orientechnologies/ >>>> orientdb/wiki/Graph-Schema) I get a lot of warnings, and with >>>> createProperty in addition it gets even worse. >>>> >>>> String url = "remote:localhost/test"; >>>> OrientGraph graph = new OrientGraph(url); >>>> try >>>> { >>>> OClass base = graph.createVertexType("base"); >>>> OClass person = graph.createVertexType("person", base); >>>> person.createProperty("name", OType.STRING); >>>> person.createIndex("personIdx", OClass.INDEX_TYPE.UNIQUE, "name"); >>>> } >>>> finally >>>> { >>>> graph.shutdown(); >>>> } >>>> >>>> Running this code results in: >>>> 19.aug.2013 12:44:56 com.orientechnologies.common.log.OLogManager log >>>> WARNING: Committing the active transaction to create vertex type 'base' >>>> as subclass of 'V'. To avoid this behavior do it outside the transaction >>>> 19.aug.2013 12:44:56 com.orientechnologies.common.log.OLogManager log >>>> WARNING: Committing the active transaction to create vertex type >>>> 'person' as subclass of 'base'. To avoid this behavior do it outside the >>>> transaction >>>> Exception in thread "main" java.lang.IllegalStateException: Cannot >>>> create a new property inside a transaction >>>> at com.orientechnologies.orient.core.metadata.schema. >>>> OClassImpl.addProperty(OClassImpl.java:387) >>>> at com.orientechnologies.orient.core.metadata.schema. >>>> OClassImpl.createProperty(OClassImpl.java:332) >>>> at com.ceeview.test.db.blueprints.BlueprintsTest1. >>>> setup(BlueprintsTest1.java:61) >>>> at com.ceeview.test.db.blueprints.BlueprintsTest1. >>>> main(BlueprintsTest1.java:29) >>>> >>>> >>>> However, if I use OrientGraphNoTx it runs without any problems at all, >>>> so is that the way I'm supposed to run createVertexType/createEdgeType >>>> calls or is there some other way that I'm not aware of? >>>> >>>> >>>> /Roar >>>> >>>> -- >>>> >>>> --- >>>> 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/groups/opt_out. >>>> >>> >>> -- >> >> --- >> 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] <javascript:>. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > -- --- 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.
