7.6. Synchronization with JDO transactions

It is sometimes useful for an application to be notified when a transaction is about to be committed or has been completed (successfully or not). The transaction interface facilitates this by providing for the registration of a user-provided callback object. The callback object must implement the javax.transaction.Synchronization interface. Its beforeCompletion() and afterCompletion() methods will be called to notify the application of these events.

The synchronization interface is shown in Figure 7.2.

Figure 7.2. UML for javax.transaction.Synchronization interface

An instance of an application class ...

Get Java™ Data Objects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.