Research on Hibernate-based das implementation (3)

Source: Internet
Author: User

Generally, if someone is opposed to using hibernate, the first reason is the performance problem of hibernate.

The test result is that the time consumption of Hibernate is basically 1.4 times that of JDBC. Among them, I think a big problem is the memory usage of the cache. The most basic problem is that hibernate will save all newly inserted objects in the session-level cache, in fact, these newly inserted objects are not immediately used in general web systems.

To solve this problem, hibernate3.2 adds the statelesssession implementation. The statelesssession provides the command-oriented API, which extracts all the objects that are detached. It is irrelevant to the cache, dirty-checking, association, collection, and interceptor.

Its insert/update/delete/select operations can be considered as common JDBC operations. Example in reference is as follows:

Statelesssession session = sessionfactory. openstatelesssession ();
Transaction Tx = session. begintransaction ();

Scrollableresults MERs = session. getnamedquery ("getcustomers ")
. Scroll (scrollmode. forward_only );
While (customers. Next ()){
Customer customer = (customer) MERs. Get (0 );
Customer. updatestuff (...);
Session. Update (customer );
}

TX. Commit ();
Session. Close ();

 

Unfortunately, gavinking does not have statelesssession in SDO mode.

 

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.