The difference between Java persistence (JDBC, MyBatis, Hibernate, SPRINGJDBC)

Source: Internet
Author: User
JDBC, Ibtais, Hibernate, SPRINGJDBC is we usually in the process of development of the use of more than a few of the persistence of technology, specific in the development process how to choose it.

First of all, the characteristics of the first is JDBC, this is the Java language provided by the specification, the main is to define some interfaces and communication classes, the interface is well defined, the various database vendors to provide specific implementation, such as Oracle,mysql, and so on, these manufacturers have their own JDBC specific implementation, of course, We can also implement one ourselves, but the cost is high. For JDBC, the main characteristics of the individual is the original, high efficiency (with good use of the case), the use of more flexible, the shortcomings are also very obvious, the development of the code more verbose, scalability is not good enough.

Then Ibatis, now renamed MyBatis, is a semi-automatic ORM framework that requires us to write our own SQL statements, with the main feature of mapping SQL statements and Java field, and mapping through Parametermap and Resultmap, so , Ibatis is also more flexible to use, can write their own SQL, and if your company has a master DBA, to give him to optimize or write SQL is also a good choice, the disadvantage, because the SQL statement and the specific database, changed the database, Then the SQL statement needs to be rewritten or modified.

Compared with the ibatis is a lot of hibernate, which can be considered an automated ORM framework, should be for his own HQL statement interpreter, using this feature, developers can write a HQL statement can be, as long as in different databases using different drivers, This can be more convenient in different db switch or transplant, but some more complex SQL statements in the conversion to HQL statements are more difficult, if there is no hibernate development master, personal feel or use ibatis better

Spring's core idea is IOC and AOP, but in order to compete with other frameworks, Spring has also implemented a set of JDBC things that can be used to simplify the amount of code developed, and spring itself provides powerful support for things, This is where I think he's more characteristic.

Therefore, the general project before the development of the first frame, choose what kind of persistence scheme according to the situation of their own team, rather than what others say good on what to use.

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.