Package org.neo4j.kernel

Examples of org.neo4j.kernel.EmbeddedGraphDatabase.beginTx()


    @Test
    public void testReadOnlyOperationsAndNoTransaction()
    {
        GraphDatabaseService db = new EmbeddedGraphDatabase( PATH );

        Transaction tx = db.beginTx();
        Node node1 = db.createNode();
        Node node2 = db.createNode();
        Relationship rel = node1.createRelationshipTo( node2, withName( "TEST" ) );
        node1.setProperty( "key1", "value1" );
        rel.setProperty( "key1", "value1" );
View Full Code Here


        registerShutdownHook( graphDb );
        // END SNIPPET: startDb

        // START SNIPPET: operationsInATransaction
        // Encapsulate operations in a transaction
        Transaction tx = graphDb.beginTx();
        try
        {
            Node firstNode = graphDb.createNode();
            firstNode.setProperty( NAME_KEY, "Hello" );
            Node secondNode = graphDb.createNode();
View Full Code Here

    @Test
    public void deleteIndex()
    {
        GraphDatabaseService graphDb = new EmbeddedGraphDatabase( "target/graphdb-delete" );
        Transaction transaction = graphDb.beginTx();
        try
        {
            // START SNIPPET: delete
            IndexManager index = graphDb.index();
            Index<Node> actors = index.forNodes( "actors" );
View Full Code Here

{
    @Test
    public void question5346011()
    {
        GraphDatabaseService service = new EmbeddedGraphDatabase( "target/soquestion-test" );
        Transaction transaction = service.beginTx();
        try
        {
            RelationshipIndex index = service.index().forRelationships( "exact" );
            // ...creation of the nodes and relationship
            Node node1 = service.createNode();
View Full Code Here

{
    public static void main( String[] args )
    {
        GraphDatabaseService db = new EmbeddedGraphDatabase( args[0] );
        Index<Node> index = db.index().forNodes( "index" );
        Transaction tx = db.beginTx();
        try
        {
            Node node = db.createNode();
            index.add( node, "key", "value" );
            index.delete();
View Full Code Here

    {
        String path = args[0];
        String indexName = "myIndex";
        GraphDatabaseService db = new EmbeddedGraphDatabase( path );
        Index<Relationship> index = db.index().forRelationships( indexName );
        Transaction tx = db.beginTx();
        Node node = db.createNode();
        Relationship relationship = db.getReferenceNode().createRelationshipTo( node, DynamicRelationshipType.withName( "KNOWS" ) );
        index.add( relationship, "key", "value" );
        tx.success();
        tx.finish();
View Full Code Here

        Map<String,String> config = new HashMap<String,String>();
        config.put( "relationship_grab_size", "1" );
        String storePath = getStorePath( "neo2" );
        deleteFileOrDirectory( storePath );
        EmbeddedGraphDatabase graphDb = new EmbeddedGraphDatabase( storePath, config );
        Transaction tx = graphDb.beginTx();
        Node node1 = graphDb.createNode();
        Node node2 = graphDb.createNode();
        node1.createRelationshipTo( node2, MyRelTypes.TEST );
        node2.createRelationshipTo( node1, MyRelTypes.TEST2 );
        node1.createRelationshipTo( node2, MyRelTypes.TEST_TRAVERSAL );
View Full Code Here

        node1.createRelationshipTo( node2, MyRelTypes.TEST );
        node2.createRelationshipTo( node1, MyRelTypes.TEST2 );
        node1.createRelationshipTo( node2, MyRelTypes.TEST_TRAVERSAL );
        tx.success();
        tx.finish();
        tx = graphDb.beginTx();
        Set<Relationship> rels = new HashSet<Relationship>();
        RelationshipType types[] = new RelationshipType[] {
            MyRelTypes.TEST, MyRelTypes.TEST2, MyRelTypes.TEST_TRAVERSAL };
        graphDb.getConfig().getGraphDbModule().getNodeManager().clearCache();
       
View Full Code Here

        @Override
        public void run()
        {
          while ( true )
          {
            Transaction tx = db.beginTx();
            try
            {
              for ( int i = 0; i < 100; i++ )
              {
                                String key = keys[i%keys.length];
View Full Code Here

        xaDs.registerDataSource( "noob", noob, UTF8.encode( "554342" ) );
       
        Panic panic = new Panic();
        graphDb.registerKernelEventHandler( panic );
    
        org.neo4j.graphdb.Transaction gdbTx = graphDb.beginTx();
        TransactionManager txMgr = graphDb.getConfig().getTxModule().getTxManager();
        Transaction tx = txMgr.getTransaction();
       
        graphDb.createNode();
        tx.enlistResource( noob.getXaConnection().getXaResource() );
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.