Understand Hibernate's Flushmode.never

Source: Internet
Author: User
Tags flush

I. Background of the case:

Pictures from the movie "Born Killer"

Hibernate did not provide a good help for the massive data collection, which may have been considered less necessary by developers, and instead increased the complexity of the hibernate framework. So the concept of "maximum data volume = Batch processing", "Hibernate/java is not the best place to batch processing" in Hibernate development, some developers even directly using Hibernate to establish a session, Gets its connection and then makes JDBC operations. JDBC is not an antique, but in the hibernate call it again, it is inevitable some helpless. Recently, on the official jar of hibernate, I saw Gavin's "understand Flushmode.never" to the novice, referring to the blog of Tim, author of the Stripes Project (the fashionable project I have always been concerned about). After reading two people's comments, share with everyone.

Second, the performance of the killer?

The picture is from the movie "This killer is not too cold"

"My current DNA restructuring system, with its complex and massive OLTP data, deals with these complex objects (thousands of) in memory by relying on user interfaces (not batch processing) to implement use-case drivers," Tim wrote in his blog. "This is half a joke, I think of that delved life, really let every developer use abacus arithmetic?"

Session.setflushmode (Flushmode.never);

This statement is simple, but it solves the big problem. It tells the hibernate session not to flush any state changes to the database anytime, unless the developer calls Session.flush () directly. It sounds logical, but why does it affect performance in some scenarios, and in other scenarios it's like a feather?

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.