1.

What is Generator Class? List the default generator classes provided by the Hibernate Framework?

Answer»

Transaction is a single UNIT of work. It is single-threaded and abstracts the application from the underlying JDBC or JTA transaction. A transaction is associated with a session. It is instantiated by calling the session.beginTransaction() method. The transaction interface has the FOLLOWING methods: 

  1. void begin(): starts a new transaction 
  2. void commit(): ENDS a transaction. It does not work if the mode is FlushMode.NEVER 
  3. void rollback(): rolls BACK a transaction to the last commit forcefully 
  4. void setTimeout(int seconds): it sets a timeout for any transaction that is started by a call to begin the transaction on the particular instance. 
  5. booleanisAlive(): it returns a true or false and checks if the transaction is still alive. 
  6. void registerSynchronization(Synchronization s): this method registers a user synchronization CALLBACK for the transaction. 
  7. booleanwasCommited(): returns a true or false and checks if the transaction has been commited successfully. 
  8. booleanwasRolledBack(): returns a true or false and checks if the transaction rollback was successful. 

Every transaction has a set of properties called ACID properties. ACID stands for Atomicity, Consistency, Isolation, Durability. 



Discussion

No Comment Found