This worked, I removed all transactional code within my hook and the edges got created as expected.
HOWEVER I cannot query the resulting database - it is almost as if it did not close properly. I am using final ODatabaseDocumentInternal db = ODatabaseRecordThreadLocal.INSTANCE.get(); within my hook. if I execute *select from tyre where brand = "Michelin" *the query never ever returns... Is there a special way to close the database instance within my hook? or is there a way to find out why a query is taking so long? On Thursday, July 16, 2015 at 10:44:50 AM UTC+1, l.garulli wrote: > > What about creating edges without starting a new TX? You can't open a new > transaction in a hook. > > Best Regards, > > Founder & CEO > OrientDB <http://orientdb.com/> > > > On 16 July 2015 at 10:18, Simon White <[email protected] > <javascript:>> wrote: > >> Can no one help me with this? are nested triggers not possible? >> >> >> On Tuesday, July 14, 2015 at 11:22:32 AM UTC+1, Simon White wrote: >>> >>> public static void createAndLinkWheels(String carOrid) >>> { >>> final ODatabaseDocumentInternal db = >>> ODatabaseRecordThreadLocal.INSTANCE.get(); >>> >>> db.begin(); >>> >>> //insert wheel >>> ODocument wheel = new ODocument("wheel"); >>> wheel.field( "type", "14"); >>> wheel.save(); >>> >>> //link wheel >>> db.command(new OCommandSQL("create edge car_has_wheel from " + >>> carOrid + " to " + wheel.getIdentity().toString())).execute(); >>> >>> db.commit(); >>> } >>> >>> public static void createAndLinkTyres(String wheelOrid) >>> { >>> final ODatabaseDocumentInternal db = >>> ODatabaseRecordThreadLocal.INSTANCE.get(); >>> >>> db.begin(); >>> >>> //insert tyre >>> ODocument tyre = new ODocument("tyre"); >>> tyre.field( "brand", "Michelin"); >>> tyre.save(); >>> >>> //link tyre >>> db.command(new OCommandSQL("create edge wheel_has_tyre from " + >>> wheelOrid + " to " + tyre.getIdentity().toString())).execute(); >>> >>> db.commit(); >>> } >>> >>> But wheelOrid comes in as negative and wheel.getIdentity().toString() is >>> negative too! >>> >> -- >> >> --- >> 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/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.
