Service-layer database transactions

Service-layer database transactions

Database transaction behavior is defined on a per-method basis in the service.xml Spring configuration file. Service classes with methods that need to run as transactions inherit the parent bean named txProxyTemplate in service.xml. txProxyTemplate has a property called transactionAttributes that defines the nature of transactions for methods matching particular name patterns. For example, if you include the following property in a service that inherits txProxyTemplate, all service methods whose names begin with update will be run in a transaction.