Conversation
|
@Zyqsempai this is the contribution we offered earlier this year |
ce89c66 to
0ab0fa4
Compare
|
The additional documentation can be found in a gist: spring-data-reference-repositories-transactions.md |
|
@MalteJoe @jakobjoachim its on the way |
|
Thanks for this awesome contribution, I will review it as soon as I will have time. |
There was a problem hiding this comment.
Hi @aburmeis,
as far as I can see, ArangoTransactionManager assumes that the db and all the collection involved in the transaction already exist when beginning the transaction. Unfortunately, this is not the case with the current implementation. In fact db and collections are currently initialized lazily. They are checked if exist only when the first operation upon them is performed. This behavior should change, as pointed out in #125 and all data definitions like db, collections, indexes, should be checked on startup.
A further complication derives from the fact that we should support SPEL expressions in dbs and collections names, i.e. see
It should be possible checking existence of db and collections in the ArangoTransactionManager, but note that in case you need to create a collection, you should remember to dinamically evaluate the name in case it contains a SPEL expression and consider the related create options (https://github.com/arangodb/spring-data/blob/286b502d78bee5e5d5f551b4c2213238919fe625/src/main/java/com/arangodb/springframework/annotation/Document.java). To do it, you should ideally have the related entity class, see
Therefore, instead of using labels strings to specify write collections of the transaction, it would be ideal having a dedicated annotation which would allow specify the entity classes directly (eg. @ArangoTransaction(writeCollections = {Actor.class, Movie.class})).
54c7fbd to
3307750
Compare
|
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Malte Jörgens.
|
3307750 to
8c14e8a
Compare
|
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Malte Jörgens.
|
8c14e8a to
68c60f7
Compare
|
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Malte Jörgens.
|
1 similar comment
|
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Malte Jörgens.
|
2c98ca6 to
541b112
Compare
|
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Malte Jörgens.
|
541b112 to
499fe1a
Compare
|
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Malte Jörgens.
|
2 similar comments
|
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Malte Jörgens.
|
|
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Malte Jörgens.
|
e75199b to
25b8270
Compare
|
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Malte Jörgens.
|
1 similar comment
|
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Malte Jörgens.
|
aa938a2 to
0ffeb3c
Compare
|
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Malte Jörgens.
|
… as they will be removed with driver 7)
a04ed81 to
cef47a0
Compare
|
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Malte Jörgens.
|
As mentioned in #80 this introduces a platform transaction manager based on Arango stream transactions. Do do so, all queries and the simple repository have to use options including the transaction id. As stream transactions need all collections written on creation, additional ones can be passed as labels from the
@Transactionalannotation.The
ArangoTransactionManagerwill handle each transaction as one stream transaction allowing implicit read from undeclared collections. Isolation level will be repeatable read (serialisable is not supported). All write collections have to be declared, either explicit using@Transactional(label = {"Entities", "hasEdge"})or implicit from the first AQLWITH(will be combined as the stream transaction begin is postponed until the first query is fired). Any defined transaction timeout is used as lock timeout of the stream transaction.The manager implements
Propagation.REQUIREDandPropagation.SUPPORTSonly (REQUIREDis the default). Any other will fail due to lack of suspend/resume implementation.Transaction management is enabled the following way:
The typical use case would make all public methods of a service transactional read only and the mutating ones declaring the collections:
You can also use programmatic transactions with support from
TransactionAttributeTemplate. Either create one usingDefaultTransactionAttributeor set labels before callingexecute().