![]() In hibernate, it is better to rollback the transaction if any exception occurs, so that resources can be free. boolean wasRolledBack() checks if the transaction is rolledback successfully.Įxample of Transaction Management in Hibernate.boolean wasCommited() checks if the transaction is commited successfully.void registerSynchronization(Synchronization s) registers a user synchronization callback for this transaction. ![]() boolean isAlive() checks if the transaction is still alive.void setTimeout(int seconds) it sets a transaction timeout for any transaction started by a subsequent call to begin on this instance.void rollback() forces this transaction to rollback.void commit() ends the unit of work unless we are in FlushMode.NEVER.The methods of Transaction interface are as follows: It maintains abstraction from the transaction implementation (JTA,JDBC).Ī transaction is associated with Session and instantiated by calling session.beginTransaction(). In hibernate framework, we have Transaction interface that defines the unit of work. A transaction can be described by ACID properties (Atomicity, Consistency, Isolation and Durability). In such case, if one step fails, the whole transaction fails (which is termed as atomicity). ![]() A transaction simply represents a unit of work.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |