Ibatis VS Hibernate Persistence Layer
2. As long as you are using a relational database, it is necessary to understand why is called relational database, rather than called object-oriented database, object-oriented put those views, to get the design on the Treasury, the latter on the maintenance and tuning, you have to take responsibility, should not allow developers to decision makers for the early Capigu . I have seen some people, under the banner of OO and scalability of the banner, put a table of direct religious ties, demolition has become a three tables, but these three tables, originally, only necessary to add a type field, make some redundant Balance can be a table. Inquiries now, but these three form a Union to the investigation. When demand changes, the addition of a field, not only to change the three categories, but also to change the three tables, it is incest.
3.One-One of the library table designed for the DBA is concerned, is not a best practice design. Can not for Hibernate, deliberately put large table is split into a small table, and then some categories, resulting in One-One of the mapping relations. The integrity of the partition could not be, after all, the development of people at debugging, testing and maintenance time, look more like database data, originally a SQL, on the check out, and now want to go check a number of the table.
4. Additions and deletions to keep the entity maintaining Ibatis than Hibernate, Say the truth, Now, let me write a SQL to safeguard the maintenance of many-to-many relationship between entities, I will have to consider on a half-day, let alone write code.
5. You need to write native SQL you want It first confirmed that the requirements of the project you do not need to write native SQL , and then speaking Ibatis and Hibernate is good or bad, in the native SQL on Writing, in particular, are dynamically generated SQL, ibatis than you win some and Hiberante One fight, ibatis is like a template, like the SQL Writing in the configuration file, the centralized configuration, in particular, the technology leader Convenience project members to monitor the SQL Writing good or bad, but there is no learning curve, it has been done on the Writing SQL.
Someone will say, Hibernate also supports write SQL, but to write code which means losing the original Hibernate-based DAO of the simplicity. DAO is not that simple, if you will fight the dynamic SQL code is also placed among the DAO, the DAO will be filled with many If. . Else. . Such statement, A lump of a lump of very spectacular .
Others will say, Hibernate also supports named query will be written in SQL mapping file, the named query, however, only supports fixed placeholder, that is to say, where a =? And b =? And c =?, Is three question marks, that is, three question marks, Chuan Senate, the less one will not work. But a lot of project inquiries, are dynamic, meaning that the user selected the query will generate the placeholder.
Hibernate can not be done.
People would have said, I use Hibernate to write a framework, it can be done, then you probably write better than Ibatis may also be bad, you have to build the wheel, who could not stop.
5. Early tuning tuning, some Bad SQL, in fact, in the code review phase, Ibatis only have to look at the SQL configuration file, you can strangle out, if you use HSQL, probably will not be found, because it not only hidden in the code which some time, but also ran up the procedures required by the log print out SQL or through other tools such as P6Spy look out.
Post-tuning, are tuning now that I think are on the must have encountered bottlenecks, probably want to do in the library table on redundancy, probably want to check those Bad SQL, may have to modify the code, you may want to use up some of DBA-level tuning means, then transferred superior depth, Ibatis more advantages can be reflected, for example, increase the temporary table, middle table, increase redundancy and other fields.
6. The development of speed
If the project were not a Hibernate expert, your relative complexity of the project, not only have complicated the relationship between database tables, queries have many statements, then the use of Hibernate, the speed than on Ibatis.
The question is, how Hibernate can be considered a master, Do not look on the forum, so many people, anger exciting said at Hibernate's good, who are true masters?
I know a person, even the naming Hibernate query, pessimistic locking, optimistic locking type, are not clear, it also said: "Say Hibernate bad people, but he would not use Hibernate, master the use of EJB with the same very Smoothly , "my life and the most annoying person on the such, they clearly used Spring is very simple and very happy, Why use EJB, charge master. Change from project to make use of dynamic query Ibatis quickly to resolve the problem, but why do we want to learn Hibernate inside Dongdong profound, are not like this is the master?
7. Platform portability
If you do the project products, and intends to multiple database platform based on the release, the use of Hiberante is not to say.
8. If you do not consider the maintenance of transplantation, Ibatis can not be bad in the maintenance of Hibernate, database table changes caused by changes in entity class, HSQL will have changes, someone will say there is nothing changed, he said this person will only be possible throughout the day there is select *, if iBATIS is written this way, there was no need to move.
HSQL Good read? , From order, is indeed very easy, but the practice, which is to do take HelloWord example, What is the difference?
9. My projects at the actual use of project Background:
Hibernate2 start from my own use, I now do not think my players are Hibernate, I also did not have time to go into Hibernate, deeper things, I do not enjoy sitting next to Old developers , to help them solve the problems encountered by Hibernate , because I myself have a lot of things to do.
My projects in the Hibernate connection, have a stronger person than I, he also annoying to see Hibernate print out the sql, watch Old , and then transferred on Old , project progress, the wind has passed wind .
The higher the level of the people, the more serious the mission, few have time and patience to solve the general problem.
Finally the use of:
At Spring-based containers affairs management,
Zeng, delete, change, maintain and affairs at the inquiry, the use of Hibernate.
Non-transactional inquiries and statements, are Ibatis, maintaining a very intuitive convenience, speed up the development of a lot of it quickly.
I think it is now the technical replacement soon, the use of a technology, first of all is to solve the problem quickly, and then to study his thought, those who have always clinging Hibernate, since the study to consider the design of ORM techniques people, go to Let the study.
I have to use some aspects of Hibernate, I feel good enough on the list, Doesn't every day into HSQL , if there is time, I think that lying on the lawn to see if Unix programming art, look at the code Guinness, take a look at Oracle's provision process art, than watch the SB book Hibernate want more comfortable.
Easy be able to bring happiness, used EJB, use Spring's people, have experience, then that would be an ideological rebirth.
IBATIS designers think in the new projects, you can use Hibernate, the legacy of the old projects, you can use Ibatis, do not understand why he said so, it would be and there is no difference between the old and the new project? New projects on the true you can use Hibernate.
Related Posts of Ibatis VS Hibernate Persistence Layer
-
Software engineer must know the concept of the 10
35 kilometers wrote "excellent software engineers make the best use of design patterns and diligent code Reconstruction, the preparation of unit testing, and has easy religious pursuit. In addition to these, excellent software engineers but also ...
-
What is the JPA
Same, JDO, also started compatible JPA. At the field of ORM, it seems that JPA is a benevolent government, is the normative specification. At the support of major manufacturers, JPA use became widespread. 2 Spring Spring + Hibernate often referred to ...
-
Choose Hibernate or iBATIS has its reasons
Hibernate features: Hibernate powerful database has nothing to do with good, O / R mapping ability, and if you are very proficient in Hibernate, but also for Hibernate to conduct an appropriate package, then your project will be the entire persistenc ...
-
Hibernate Mapping Types
Hibernate mapping types divided into two categories: built-in mapping types and mapping types of customers. Built-in mapping types is responsible for some common Java types are mapped to the corresponding SQL type; In addition, Hibernate also allows ...
-
Hibernate configuration parameters hibernate.hbm2ddl.auto
Hibernate in the configuration file: <properties> <property name="hibernate.hbm2ddl.auto" value="create" /> </ properties> Parameter Description: validate load hibernate, the authentication to create a database t ...
-
What is the appfuse
First, Appfuse brief introduction Matt Raible are Appfuse developed a guiding entry-level J2EE framework, how to integrate its popular Spring, Hibernate, ibatis, struts, Xdcolet, junit, etc. give the basic framework of the model, the latest version 1 ...
-
Nan-Jing 5: When IBatis.Hibernate mixed affairs, pay attention to your SQL
[Problem] Now, in the development of the so-called multi-storey JavaEE applications, data persistence layer is always essential, and "Automatic" of ORM - Hibernate, and "all-manual-type" of SqlMap - IBatis, equivalent data are Per ...
-
Hibernate.cfg.xml configuration file (including the primary key generation strategy Introduction)
Hibernate.cfg.xml configuration file: <? xml version = "1.0" encoding = "utf-8"?> <! DOCTYPE hibernate-configuration PUBLIC "- / / Hibernate / Hibernate Configuration DTD / / EN" "hibernate-configuration-2.0.dtd













Leave a Reply