We chose to rely heavily on stateless session EJBs for most of our transactions. This model is lightweight and scales very well, but relies on the application for binding to the database. An application transaction, for example, a purchase, typically is a combination of all three types of transaction. When an item is to be purchased, information must be stored in the database, a fulfillment system must be contacted, and the credit card interface must be used. If any of these actions fail, the whole purchase transaction must fail and leave the purchasing system in a valid state.
Database transactions are straight-forward.
The credit card transactions are not so easy. The credit card server is provided as a service by another vendor. This API allows a native function call in C, for example, to be accessed as a Java method within a Java program. Our final transaction type involves sending and receiving information with the fulfillment systems. From the purchasing system, this interface appears as a local transaction.