Generally you set the level of transaction locking or serializability.
From JBoss3.0 Quickstart.pdf
Transaction Isolation and Locking
Transactions should be isolated from each other to avoid conflicts because a transaction in
progress could change data that another transactions depend on. In J2EE there are four
different levels of isolation:
Read uncommitted: a transaction can read changes made by another transaction even
not committed or rolled back.
Read committed: a transaction cannot read any changed by another transaction until
it is committed.
Repeatable reads: a transaction cannot change data read by another transaction
Serializable: a transaction has exclusive read and write access to the data it is using.
Note that even this isolation levels are specified in the J2EE specification the
implementation depends heavily on the underlying database thus even on the same
application server with different database we can have slightly different behaviors.