Like RDBMS, OrientDB upholds exchanges ACID properties. An exchange contains a unit of work performed inside an information base administration framework. There are two fundamental motivations to keep up exchanges in an information base climate.
- To permit simultaneous recuperation from disappointments and keep an information base reliable even if there should be an occurrence of framework disappointments.
- To give confinement between programs getting to an information base simultaneously.
Naturally, the information base exchange should follow ACID properties, for example, Atomic, Consistent, Isolated, and Durable properties. In any case, OrientDB is an ACID consistent data set, which implies it doesn't repudiate or refute the idea ACID, yet it changes its discernment while dealing with the NoSQL information base. Investigate how ACID properties work alongside NoSQL information base.
- Nuclear − When you plan something for change the data set the change should work or fall flat in general.
- Steady − The data set ought to stay reliable.
- Segregated − If other exchange executions are executing simultaneously, at that point the client won't have the option to see the records in simultaneous execution.
- Solid − If the framework crashes (equipment or programming), the data set itself ought to have the option to take a reinforcement.
Data set exchange can be accomplished by utilizing Commit and Rollback orders.
Commit
Submit implies shutting the exchange by saving all progressions to the data set. Rollback implies recuperate the information base state to where you opened the exchange.
The accompanying assertion is the fundamental language structure of the COMMIT information base order.
COMMIT
Note − You can utilize this order exclusively subsequent to associating with a specific information base and in the wake of starting the exchange.
Example
In this model, we will utilize a similar data set named 'demo' that we made in a prior section of this instructional exercise. We will see the activity of submit exchange and store a record utilizing exchanges.
You need to initially begin the exchange utilizing the accompanying BEGIN order.
orientdb {db = demo}> BEGIN
Supplement a record into a worker table with the qualities id = 12 and name = satish.P utilizing the accompanying order.
orientdb> INSERT INTO employee (id, name) VALUES (12, 'satish.P')
You can utilize the accompanying order to submit the exchange.
orientdb> commit
In the event that this exchange effectively dedicated, you will get the accompanying yield.
Transaction 2 has been committed in 4ms
Rollback
Rollback implies recuperating the data set state to where you opened the exchange.
The accompanying assertion is the essential grammar of the ROLLBACK data set order.
ROLLBACK
Note − You can utilize this order simply in the wake of interfacing with a specific data set and in the wake of starting the exchange.
Example
In this model, we will utilize a similar data set named 'demo' that we made in a prior section of the instructional exercise. We will see the activity of rollback exchange and store a record utilizing exchanges.
You need to initially begin the exchange utilizing the accompanying BEGIN order.
orientdb {db = demo}> BEGIN
Supplement a record into a representative table with the qualities id = 12 and name = satish.P utilizing the accompanying order.
orientdb> INSERT INTO employee (id, name) VALUES (12, 'satish.P')
You can utilize the accompanying order to recover the records of the table representative.
orientdb> SELECT FROM employee WHERE name LIKE '%.P'
On the off chance that this order is executed effectively, you will get the accompanying yield.
---+-------+--------------------
# | ID | name
---+-------+--------------------
0 | 12 | satish.P
---+-------+--------------------
1 item(s) found. Query executed in 0.076 sec(s).
You can utilize the accompanying order to Rollback this exchange.
orientdb> ROLLBACK
Check the select question again to recover a similar record from the Employee table.
orientdb> SELECT FROM employee WHERE name LIKE '%.P'
On the off chance that the Rollback is executed effectively, you will get 0 records found in the yield.
0 item(s) found. Query executed in 0.037 sec(s).