Are write specific procedures within Hibernate obstructing? I am talking about, basically execute:
from the method that is annotated as @Transactional, could it be guaranteed that each
call, from a different thread, performed soon after this line, will return proper data (not null)?
The end result that you will get is dependent around the transaction isolation level. Spring enables the next isolation levels:
DEFAULT Make use of the default isolation degree of the actual datastore.
READ_COMMITTED A continuing showing that dirty reads are avoided non-repeatable reads and phantom reads can happen.
READ_UNCOMMITTED A continuing showing that dirty reads, non-repeatable reads and phantom reads can happen.
REPEATABLE_READ A continuing showing that dirty reads and non-repeatable reads are avoided phantom reads can happen.
SERIALIZABLE A continuing showing that dirty reads, non-repeatable reads and phantom reads are avoided.
Calling the save() (or flush()) does not guarantee the transaction is committed. Within the situation whenever your transaction(in which the save() is known as) commits prior to the get() is known as, you'll ALWAYS obtain the correct increase the risk for new thread. However, when the transaction isn't committed, whether you receive the right result or otherwise is dependent around the transaction isolation level. You're going to get the right increase the risk for isolation levels that permit "Dirty Reads".
Write procedures aren't block unless of course you utilize pessimistic securing clearly. Inside a transaction, ultimately the not-committed won't be visible to anybody outdoors this transaction (presuming the default isolation level READ_COMMITTED). While you pointed out
get() are running in various threads and therefore different transactions, everything is dependent upon the very fact the sometimes of get() if the save() was committed or otherwise.