The meaning of transactionattributes attributes:
Propagation_required -- supports the current transaction. If no transaction exists, a new transaction is created. This is the most common choice.
(Applicable to processing one or more cross insert, update, and delete operations)
Propagation_supports -- supports the current transaction. If no transaction exists, it is executed in non-transaction mode.
(Applicable to processing one or more cross insert, update, delete, query)
Propagation_mandatory -- supports the current transaction. If no transaction exists, an exception is thrown.
(Used to check whether the query contains insert, update, and delete statements)
Propagation_requires_new -- creates a transaction. If a transaction exists, it is suspended.
Propagation_not_supported -- executes operations in non-transaction mode. If a transaction exists, the current transaction is suspended.
Propagation_never -- runs in non-transaction mode. If a transaction exists, an exception is thrown.
(Applicable to full query)
Propagation_nested -- if a transaction exists, it is executed within the nested transaction. If no transaction exists, perform a similar operation as propagation_required.
Note that if all queries use propagation_required, the efficiency of querying more than 100 pieces of data is significantly longer.
Test 113 data records and 4 fields by yourself
Permission_id varchar2 (20) not null,
Permission_name varchar2 (200) not null,
Function_id varchar2 (20) not null,
Flag char (1) not null
Query:
Session S = sessionfactory. opensession ();
Date date1 = new date ();
List sulist = S. createquery ("from sshpermission"). List ();
Date date2 = new date ();
Long I = date2.gettime ()-date1.gettime ();
System. Out. println (I );
Use propagation_never
703
Use propagation_required
766