transactionsjavabeanscdiconversation-scopejavax

difference between Transaction and Conversation in Java


I'm pretty new to java. Can someone tell me: when to use Transaction and when to use Conversation in Java? I know that a transaction is present in a database(update->delete->commit), but it's utility it's only in this case ?

Thanks in advance


Solution

  • A transaction is a indivisible unit of work that is used to maintain data integrity.

    Within a conversation scope, a bean will keep its state until the conversation ends. The conversation is binded to a HTTP session.

    Transactions and conversations are not exclusive, they go hand in hand oftentimes. The Transaction and Conversation interfaces which you may be referring to are utils to manipulate the target transaction or the conversation in the given context.

    About conversation scope

    About the Java Transaction API