# Transaction Persistence (Saving Transaction Data)

In some cases it may be useful to save the transaction data for testing and debugging. Expere IE solution’s flexible and configurable architecture provides this capability. The SelectAndGenerate method does not store the transaction data to the database, and the Generate method deletes an existing transaction from the database. There are three alternate ways to allow transaction data to be persisted by the business encapsulation methods and saved to the database.

- Alternate API methods
- Target Service
- Server JNDI Resource Mapping

## Alternate API methods

The simplest way to have the transaction data persisted is to call alternate persistent API method, instead of SelectAndGenerate call SelectGenerateAndSave, and instead of Generate call GenerateAndSave. The structure of the non-persistent methods and the persistent version are identical with the exception of the root element of the request. Simply make the request to the persistent version of the API method and the transaction data will be persisted.

## Target Service

The target service indicates what processing is being requested and may be specified in the request URL. If it is desired to have the client still construct the SOAP request as though the request was to a non-persistent API method, but in fact have the request processed as though it was to the persistent API method, this can be achieved by specifying the target service in the request URL.

For example, consider a client who is making a request for SelectAndGenerate to the URL http://myserver/Common/WSEndpoint?service=SelectAndGenerate. For debugging purposes the client wishes to have the transaction data persisted, but does not desire to change the root element of the API method request to SelectGenerateAndSave, the client can send a SelectAndGenerate request to http://myserver/Common/WSEndpoint?service=SelectGenerateAndSave. This will cause the request to be processed as though it was a request to SelectGenerateAndSave.

## Server JNDI Resource Mapping

If it is desired to save the transaction data for all requests to a single server the server may be configured to route the requests to a non-persistent API method to the alternate persistent API method. This configuration is done on the J2EE application server through standard JNDI resource reference mappings. Using the J2EE application server’s configuration options, the SelectAndGenerate JNDI reference can be mapped to the SelectGenerateAndSave EJB, and the Generate JNDI reference can be mapped to the GenerateAndSave EJB. This configuration change will be transparent to the server’s clients, yet the transaction data will be persisted.