Transactionattributes must be correctly configured.

Source: Internet
Author: User

 

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.