Thứ Tư, 13 tháng 3, 2013

Difference between Hibernate Sessions and Transactions.


Session

Most technology terms mean literally what they represent in the English dictionary, well with a little ketchup. A session is a lease of time that you’d take with a fellow, or any other entity. Once you are in a session with the other entity, you can actively use it ; or communicate with whatever communication mechanism that entity has.

Transaction

A transaction occurs AFTER a session. Once you are in a session, you perform transactions. You are in absolute need to be in a session to perform a transaction. You cannot perform a transaction with an entity without being in session with it. For example let’s take an example of a ATM machine.
You go and stand in queue of waiting customers who wish to acquire a session with the ATM. Once the ATM is free, you initiate your session. Now you and the ATM are tunneled, face to face and ready to do business. You dial your pin, and this is where you start your transaction. So any material work you perform with an entity will be called a transaction. So basically the purpose of acquiring a session IS in effect because you wished to perform a transaction. The transaction is the real action that full fills the business you have with the other entity.
Making the other entity aware of yourself is hence called a session, in which you and the entity have now shaken hands. After that as you work, it’ll be termed as a transaction.

Không có nhận xét nào:

Đăng nhận xét