Complete the code to mark the transaction as read-only.
@Transactional(readOnly = [1])
public void fetchData() {
// method logic
}Setting readOnly = true tells Spring this transaction should not modify data.
Complete the code to import the correct annotation for transactions.
import org.springframework.transaction.annotation.[1]; @Transactional(readOnly = true) public void getData() { // method logic }
The @Transactional annotation is used to define transaction boundaries.
Fix the error in the transaction annotation to make it read-only.
@Transactional(readOnly = [1])
public void loadData() {
// method logic
}The readOnly attribute requires a boolean value, not a string.
Fill both blanks to create a read-only transaction with propagation set to SUPPORTS.
@Transactional(readOnly = [1], propagation = Propagation.[2]) public void queryData() { // method logic }
Setting readOnly = true and propagation = Propagation.SUPPORTS defines a read-only transaction that supports existing transactions.
Fill all three blanks to define a read-only transaction with isolation level READ_COMMITTED and timeout 30 seconds.
@Transactional(readOnly = [1], isolation = Isolation.[2], timeout = [3]) public void fetchRecords() { // method logic }
This sets the transaction as read-only, with isolation level READ_COMMITTED to avoid dirty reads, and a timeout of 30 seconds.