Can you maybe tell me which method i should choose to save the document? document.save(); or db.save(document);
is there any major perfomance benefit on any of those methods? On Wednesday, April 2, 2014 3:53:00 PM UTC+2, Nhat Nguyen wrote: > > There is no trick i can do this? Ok then maybe i have to rethink my plan. > > On Wednesday, April 2, 2014 3:49:31 PM UTC+2, Andrey Lomakin wrote: >> >> Hi, >> You can not set cluster position directly it is generated like UUID. >> >> >> On Wed, Apr 2, 2014 at 4:46 PM, Nhat Nguyen <[email protected]>wrote: >> >>> Hi, >>> >>> i tried saving document to a specific ClusterPosition in a specific >>> Cluster. After some attempts the database won´t do this. >>> >>> Here is an example: >>> >>> ODatabaseDocumentTx db = ODatabaseDocumentPool.global().acquire( >>> "local:.....", "admin", "admin" ); >>> Person p = new Person(); >>> p.setName( "Herbert" ); >>> p.setAge( 22 ); >>> >>> try >>> { >>> db.begin( TXTYPE.OPTIMISTIC ); >>> ODocument document = db.newInstance( "Person" ); >>> >>> //setting the place where this document will be stored >>> //sad part ist that orientdb immediatly thinks that this action is an >>> update (cause of the given position) not an insert. >>> document.setIdentity(9, new OClusterPositionLong(255)); >>> >>> //insert the data into the document >>> document.field("Name", p.getName()); >>> document.field("Age", p.getAge()); >>> >>> document.save(); >>> //document.save(true); >>> //db.save(document); >>> db.commit(); >>> } >>> catch(Exception e){ >>> db.rollback(); >>> e.printStackTrace(); >>> } >>> finally >>> { >>> db.close(); >>> } >>> >>> >>> does anyone has an idea? Please correct my code if im done anything >>> stupid (meaning, using the wrong api-command for the job). >>> >>> Regards, >>> Nhat >>> >>> -- >>> >>> --- >>> 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. >>> >> >> >> >> -- >> Best regards, >> Andrey Lomakin. >> >> Orient Technologies >> the Company behind OrientDB >> >> -- --- 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.
