There's no point in the groove of Hibernate, I'm speechless.

Source: Internet
Author: User

There are some super-heavyweight frameworks in the Java world, and many Java developers are even more familiar with them than the JDK itself. Yes, I'm talking about Struts, Spring and Hibernate, or the Three Musketeers called Java, the legendary SSH.

Although I am only 19 years old this year, but there are ten years of Java development experience, the current resume only dare to say familiar (non-proficient) Java programming language. Used to be a deep user of Struts and Hibernate. For the WEB framework my trajectory is: servlet, Struts 1.x, no framework, the no framework is actually inaccurate, it should be a simple encapsulation of the servlet or Filter. And in the database access this path is: JDBC-------dbutils. I don't think Dbutils is right, because I'm willing to try a variety of lightweight ORM frameworks, and Dbutils is not exactly an ORM, at best a JDBC toolkit.

Recall that when you write a variety of JDBC programs, assuming that a table has 20 fields, then a method of inserting records may have a small 30 lines of code, because there are a lot of setstring\setinteger and other methods need to call. Later Hibernate after the feeling of the original writing code is also so enjoyable, the previous 30 lines of code now only need two or three lines to get it done! Instantly feel the waist also not sour, leg also does not ache, can write dozens of method in one breath. And Hibernate early stage of similar products are not many, IBatis is a bar. Of course, a lot of ORM frameworks have sprung up a few years later!

I remember the beginning of Iteye, the Javaeye early site was hibernate.org.cn, and everyone was talking about Hibernate's various use techniques. Because the ORM at that time was a very interesting idea to completely resolve the pain of repeating the various JDBC code. A lot of people start to learn and use Hibernate, and hibernate itself is growing fast. Any software and framework can not meet the needs of users 100%, many people adapt to it, there are many people dissatisfied with the status quo to improve, or use its ideas developers a variety of similar products come out.

Choose more than there is a comparison, and then began to spit groove, summed up there are so few slot points:

    • Too heavy (indeed, a jar pack is several megabytes)
    • Package too hard, many problems are difficult to intuitively diagnose

Hibernate is really getting heavier now and has become a Spring-like product system such as Hibernate ORM, Hibernate OGM, Hibernate Search, and so on. and a Hibernate core jar package file actually has 5 m so big! That's why I chose to give up hibernate when I started developing Oschina in 08 (when the jar pack was only two trillion), and another reason I gave up hibernate was that the hibernate framework had the biggest advantage of supporting a multi-database platform for Oschina is useless, because Oschina only runs on MySQL database.

Well, what I'm trying to say is that most of the people who are in the groove hibernate may not have noticed what the biggest advantage of hibernate is, or that he didn't have a chance to use this advantage during his usual development.

Sometimes when we develop an application that requires applications to support different databases with a simple configuration, I have an open source software--dlog4j before I do Oschina, a blog software developed in Java. It is a software, it has a variety of users, some want to support MySQL, some want to support Oracle, and SQL Server. You know, although the database adheres to some common SQL standards, there are a number of different product differences, such as paging to read records, and each database's SQL statements are written differently. If you write these various adaptations specifically for each database, it's annoying to die.

Hibernate has solved this problem from the very beginning, it is easy to realize the support of different database through its dialect dialect, of course, there is a premise that if you use native SQL in your code, you need to make sure that SQL is database Independent. The entire DLOG4J project has only one or 99% SQL statements, and the others are written directly using Hibernate's API or HQL. So you want to support what database, change Hibernate dialect configuration can be.

It seems that platform development Hibernate is not a good choice, one: the platform is generally not free to replace the database; second: Hibernate is too heavy; three: There are too many ORM frameworks to choose from (see here for more ORM frameworks). and product development is hibernate, after all, the needs of a variety of customers, databases are also multifarious, want to save the hibernate it.

Finally, I want to say: No one software can meet 100% of your needs. It's like you can't spit. Liu Xiang sings out of tune, Spit Groove Jacky Cheung Run Without You fast, spit groove @ sweet potato grow than you handsome, is the same truth.

There's no point in the groove of Hibernate, I'm speechless.

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.