128 Transaction management JDOUserException, the transaction will be
128 Transaction management JDOUserException, the transaction will be rolled back. The method is not called if a rollback is instigated instead of commit. The synchronization object s afterCompletion(int status) method will be called once the transaction is complete. The status parameter indicates the success or failure of the transaction, and will have one of two values: javax.transaction.Status.STATUS_COMMITTED javax.transaction.Status.STATUS_ROLLEDBACK Validation during commit There are two different ways in which instances may be validated before they are committed to the data store. The first is to have the instances implement the InstanceCallbacks interface, and perform the validation in the jdoPreStore() method. The second is to register a callback object using the transaction interface s setSynchronization() method, and to perform the validation from its beforeCompletion() method. I am not particularly in favor of the first approach, since it is less than transparent to the domain object model; the InstanceCallbacks interface is specific to JDO. Also, the jdoPreStore() method may be called multiple times on one instance in a single transaction, as it is invoked whenever the implementation flushes data to the data store. Use of synchronization objects may seem to be an easy alternative. However, the synchronization object must maintain a list of dirty instances to be validated. Instances may be involved in other transactions where no synchronization object is registered, and so critical validation cannot be guaranteed in this way. For the time being, therefore, jdoPreStore() may actually be the better of the two alternatives. This is an area that will be the subject of much debate as JDO becomes more widely used. I anticipate that, in a future version of JDO, persistence descriptor tags will be defined to provide declarative support for validation. These may include Delete Restrict and Delete Cascade functionality, as well as the identification of a validation method for each persistence-capable class, to be automatically invoked on instances during the commit process. What s next? In the next chapter, I introduce the new query language, JDOQL, which provides a Java-like syntax for the efficient querying of persistent data through JDO.
Note: If you are looking for top 10 and very good webhost to host and run your jsp application check Actions jsp hosting services