ContactUs

Please send your Questions & Answers or Feedback to "mohan@javabook.org"

What is getTransaction method ?

getTransaction : get the Transaction instance associated with this session..
    Transaction tx = session.beginTransaction();
    tx.commit()/rollback();
        [or]
suppose if we are not assigning Transaction object to any reference then how to commit the transaction.
        session.beginTransaction();
        session.getTransaction().commit()/rollback();
In the second case we are not assigning the Transaction object to any reference so we are using the getTransaction to commit it.
Suppose if we are not starting any transaction then we cannot get the transaction object from the session.It will throw
    TransactionException -- Transaction not successfully started.
        note : using Session , we can get the Connection,SessionFactory and the Transaction.
Related Posts Plugin for WordPress, Blogger...
Flag Counter