Package org.neo4j.graphdb

Examples of org.neo4j.graphdb.GraphDatabaseService.beginTx()


    @Override
    public void init(Collection<TypeMetadata<NodeMetadata>> registeredMetadata) {
        EmbeddedNeo4jDatastoreSession session = createSession();
        GraphDatabaseService graphDatabaseService = session.getGraphDatabaseService();
        try (Transaction transaction = graphDatabaseService.beginTx()) {
            for (TypeMetadata<NodeMetadata> typeMetadata : registeredMetadata) {
                IndexedPropertyMethodMetadata<IndexedPropertyMetadata> indexedPropertyMethodMetadata = typeMetadata.getIndexedProperty();
                if (indexedPropertyMethodMetadata != null && indexedPropertyMethodMetadata.getDatastoreMetadata().isCreate()) {
                    Label label = typeMetadata.getDatastoreMetadata().getDiscriminator();
                    PrimitivePropertyMethodMetadata propertyMethodMetadata = indexedPropertyMethodMetadata.getPropertyMethodMetadata();
View Full Code Here


    @Test
    public void testBasicRepositoryFunctionality() {
        startJavaBasedAppCtx();
        GraphDatabaseService graphDatabaseService = appCtx.getBean(GraphDatabaseService.class);
        PersonRepository personRepository = appCtx.getBean(PersonRepository.class);
        try (Transaction tx = graphDatabaseService.beginTx()) {
            Person person = new Person("Howdy",50);
            personRepository.save(person);
            assertNotNull(person.getId());
            tx.success();
        }
View Full Code Here

  @Nonnull
  private T deserialize( @Nonnull AbstractNeo4jSerializer<T> serializer, @Nonnull String serialized ) throws IOException {
    GraphDatabaseService db = neo4jRule.createDb();

    //Fill the db initially
    try ( Transaction tx = db.beginTx() ) {
      ExecutionResult result = new ExecutionEngine( db ).execute( serialized );
      tx.success();
    }

    try ( Transaction tx = db.beginTx() ) {
View Full Code Here

    try ( Transaction tx = db.beginTx() ) {
      ExecutionResult result = new ExecutionEngine( db ).execute( serialized );
      tx.success();
    }

    try ( Transaction tx = db.beginTx() ) {
      return serializer.deserialize( db.getNodeById( 0 ) );
    }
  }

  /**
 
View Full Code Here

  @Nonnull
  private T deserialize( @Nonnull AbstractNeo4jSerializer<T> serializer, @Nonnull String serialized ) throws IOException {
    GraphDatabaseService db = neo4jRule.createDb();

    //Fill the db initially
    try ( Transaction tx = db.beginTx() ) {
      ExecutionResult result = new ExecutionEngine( db ).execute( serialized );
      tx.success();
    }

    try ( Transaction tx = db.beginTx() ) {
View Full Code Here

    try ( Transaction tx = db.beginTx() ) {
      ExecutionResult result = new ExecutionEngine( db ).execute( serialized );
      tx.success();
    }

    try ( Transaction tx = db.beginTx() ) {
      return serializer.deserialize( db.getNodeById( 0 ) );
    }
  }

  @Nonnull
View Full Code Here

  @Nonnull
  protected String serialize( @Nonnull Serializer<T, Node, Node> serializer, @Nonnull T objectToSerialize ) throws IOException {
    GraphDatabaseService db = neo4jRule.createDb();

    try ( Transaction tx = db.beginTx() ) {
      Node rootNode = db.createNode();
      serializer.serialize( objectToSerialize, rootNode );

      tx.success();
    }
View Full Code Here

      tx.success();
    }

    //Creates the cyper representation for this database
    StringWriter out = new StringWriter();
    try ( Transaction tx = db.beginTx() ) {
      final SubGraph graph = DatabaseSubGraph.from( db );
      new SubGraphExporter( graph ).export( new PrintWriter( out ) );
      tx.success();
    }
    return out.toString();
View Full Code Here

      expectedLabels.add(DynamicLabel.label("Group"));
      expectedLabels.add(DynamicLabel.label("AccessControllable"));
      expectedLabels.add(DynamicLabel.label("AbstractUser"));

      // intentionally create raw Neo4j transaction and create nodes in there
      try (Transaction tx = graphDb.beginTx()) {

        for (int i=0; i<100; i++) {

          final Node test = graphDb.createNode();
View Full Code Here

    try {

      final GraphDatabaseService graphDb = app.getGraphDatabaseService();

      // intentionally create raw Neo4j transaction and create nodes in there
      try (Transaction tx = graphDb.beginTx()) {

        for (int i=0; i<100; i++) {

          final Node test = graphDb.createNode();
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.