Class: Neo4j::Core::CypherSession::Transactions::Embedded

Inherits:
Base show all
Defined in:
lib/neo4j/core/cypher_session/transactions/embedded.rb

Instance Attribute Summary

Attributes inherited from Transaction::Base

#root, #session

Instance Method Summary collapse

Methods inherited from Base

#after_commit, #after_commit_registry, #post_close!, #queries, #query

Methods inherited from Transaction::Base

#autoclosed!, #close, #closed?, #expired?, #failed?, #inspect, #mark_expired, #mark_failed, #root?

Constructor Details

#initialize(*args) ⇒ Embedded

Returns a new instance of Embedded.



8
9
10
11
# File 'lib/neo4j/core/cypher_session/transactions/embedded.rb', line 8

def initialize(*args)
  super
  @java_tx = adaptor.graph_db.begin_tx
end

Instance Method Details

#commitObject



13
14
15
16
17
18
19
20
# File 'lib/neo4j/core/cypher_session/transactions/embedded.rb', line 13

def commit
  return if !@java_tx

  @java_tx.success
  @java_tx.close
rescue Java::OrgNeo4jGraphdb::TransactionFailureException => e
  raise CypherError, e.message
end

#deleteObject



22
23
24
25
26
27
# File 'lib/neo4j/core/cypher_session/transactions/embedded.rb', line 22

def delete
  return if !@java_tx

  @java_tx.failure
  @java_tx.close
end