Object API is not compatible with Graph API. Choose one of them, don't use both at the same time.
Best Regards, Luca Garulli Founder & CEO OrientDB <http://orientdb.com/> On 12 October 2015 at 15:58, Johan Sjöberg <[email protected]> wrote: > So we are trying to switch to an embedded plocal server but struggling > with creating edges. We are using the Java Object API and use SQL to create > edges. For example the following query: > > String q = "CREATE EDGE " + EdgeName.class.getSimpleName() + " FROM " + > from.getId() + " TO " + to.getId(); > > Is executed in the following way: > > db.command(new OCommandSQL(q)).execute(); > > Since we changed to embedded, plocal mode this doesn't work anymore. It > throws the following error: > > java.lang.ClassCastException: com.tinkerpop.blueprints.impls.orient. > OrientEdge cannot be cast to com.orientechnologies.orient.core.record.impl > .ODocument > at com.orientechnologies.orient.object.db.OCommandSQLPojoWrapper.execute( > OCommandSQLPojoWrapper.java:57) > > If I instead try: > > db.getUnderlying().command(new OCommandSQL(q)).execute(); > > Everything works fine. > > I understand why the second call works fine, we access the documentdb and > do all queries against this one rather than Java Object API layer. > What I don't understand is why the first one fails. Why is it using > blueprints' OrientEdge class? That makes no sense at all. > > Anyone has a solution for this? I would prefer to not having to change all > my edge creating db.command() to db.getUnderlying().command(). > Mainly because I still want the bindings to my Java classes to work > automatically. > > > -- > > --- > 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. > -- --- 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.
