When do I need to use transactions?
Created Aug 8, 2001
You need to use transactions anytime you're modifying a set of data, which could end up in a weird state if the modifications don't run to completion.
For example, changing the value of a PIN needs to be transactioned: you wouldn't want to change only the first two bytes, would you?
A number of Java Card APIs use the transaction facility. The most notable is javacard.framework.arrayCopy().
You don't need to use transactions when you're modifying a single primitive value (primitive types, one cell of an array of primitive types). The Java Card platform guarantees that these writes are atomic. However, please note that a set of atomic writes is not itself atomic, hence the need for transactions!