Database Reference
In-Depth Information
Equally,if the application is built ontop ofthe popular Spring Framework, youcan benefit
from Spring's declarative transaction support to make your code more robust. The follow-
ing listing creates a Spring JTA transaction manager, wired into the Neo4j
Transac-
tionManagerService
and
UserTransactionService
.
Listing 7.7. Configuring Spring transaction manager
This configuration gives the
APretendService
bean the ability to annotate its public
methods with Spring's
@Transactional
annotation and therefore to avoid the need to
manage transactions manually.
The next listing shows what
APretendService
looks like, including declarative trans-
action management using annotations.
Listing 7.8. Declarative transaction management
public class APretendService {
private GraphDatabaseService gds;