IBATIS: the biggest advantage is that it can effectively control the number of sql sent to improve the efficiency of the data layer execution! As if Alibaba is now using IBATIS; it requires programmers to write their own sql statements, do not want to hibernate as a fully object-oriented, automated, ibatis is semi-automated, through the table and object mapping and hand-written sql statements, to achieve higher query efficiency than hibernate and other. 1. Advantages: simple: easy to learn, easy to use, through the documentation and source code, you can more fully grasp its design ideas and implementation. Practical: provides a data mapping function , provides the underlying data access encapsulation (such as ado.net), provides a DAO framework , can make it easier for us to develop and configure our DAL layer . Flexible: through the sql basically can realize we do not use the data access framework can achieve all the functions , perhaps more. complete : provides connection management , caching support , threading support , (distributed) thing management , through the configuration of the relational object mapping and other data access layer needs to solve the problem . Provides DAO support , and in the DAO framework encapsulates the ADO.NET , NHibernate and DataMapper. enhance the system maintainability : By providing DAL layer , the separation of business logic and data access logic , so that the system's design is more clear , easy to maintain , easy to unit testing . sql and code separation , to improve the maintainability . 2. Disadvantages Lagging: There is no clear support for .NET2.0. NET2.0. The latest version can be compiled under 2.0 , but some unit tests can not be passed. Immature , less engineering practice : IbatisNet in the actual use of the project is less . Only theoretically feasible . Semi-ORM, less tool support: we need to write our own sql, and . NET has not been found under the business layer can automatically generate classes and configuration files of the tool , this is not the same as NHibernate , NHibernate will be for our database directly generate sql, and there are some auxiliary tools. Therefore use Ibatis than NHibernate to do some more work. 3. Feasibility There is no best framework, only the most suitable framework. Existence is reasonable, it exists that there is a reason for its existence. But it may not exist for us. So the main thing to choose a framework is to see if it has any meaning for you, how much meaning, is not more than other framework to bring you the benefits. There are no absolute advantages and no absolute disadvantages, it is important to see in what context the discussion. Above said part of the advantages and some disadvantages of Ibatis. These advantages theoretically prove that Ibatis is suitable for any data persistence layer, but may not be the best choice. The following advantages and disadvantages of the above are discussed from two aspects. Simplicity: We all like simplicity. Simplicity means low learning costs and low likelihood of errors in use. At the same time, simple things are generally not powerful enough. On the other hand, complex things are expensive to learn, inconvenient to use, and the team does not have strong technical strength, generally do not use. Practical: to solve the project needs to solve the problem, this is any actual engineering framework and tools should be used in the nature of the project, otherwise do not get to the actual project. Flexible: Flexible has two meanings, one is simple and easy to extend, the other is powerful to provide a lot of options.Ibatis belongs to the former, Hibernate belongs to the latter. Both have their own advantages and disadvantages. Functionality: Ibatis functionality is also relative to the integrity of the framework than our own development should be complete, but compared to other frameworks there must be some problems that can not be solved. Enhance the maintainability of the system: the use of Ibatis can do sql and code separation, you can design a clear data access layer (DAL). But whether the project architecture is scientific and reasonable, whether to maintain, the key is not in Ibatis, because it is only a data layer framework. But we also have to be clear that to take advantage of Ibatis , we need to do some extra work , such as the best design DAO interface , the need to put the business layer entities and access to the entity in a different project , as well as the need to maintain the xml configuration file . Lag: Ibatis group has not mentioned to support .NET2.0 now, many people in .NET2.0 under the use of Ibatis have problems. So if you want to use .NET2.0 development , IBatis is not a good choice , you still need to wait . Immaturity: It is hard to say that open source stuff is mature, but it is generally more mature than the frameworks we write ourselves. Since we can get his source code, the key is whether we can master it. Semi-ORM, tool support: This is destined to Ibatis can not essentially improve the development efficiency, we need to write their own sql, write entity classes, write configuration files. But this is also its superior place, it did not do for us he more, so we have more space to play. And it is ideal for those who do not have full control over the database system and the need to take advantage of the advanced features provided by the database itself statistical query system development. With Ibatis you need to write your own sql, and since our sql is not likely to be fully compliant with the sql standard, it is less portable than the sql generated by NHibernate. However, since we are less likely to change the database, it is not essential for us that the sql is standards compliant so that we can minimize the cost of migrating to a different server. On the other hand, NHibernate, while shielding many differences between databases, makes it difficult to take advantage of the advanced features of some databases, such as Oracle's analytic statistics functions. NHibernate is not suitable for the database schema is not standardized, the constraints are not complete, the need for a large number of complex queries of the system , at the same time NHibernate's learning costs are higher, fully master NHibernate is also more difficult, more risky. Write your own framework may not be better than Ibatis, stable, powerful and scalable. And the development of their own framework also requires a large amount of work. If you use DotNet and want to choose a data layer framework, and the system has a significant portion of the more complex sql, or database design is not reasonable, dirty data, performance and resource requirements of strict, Ibatis is a better choice. Those of his shortcomings are not fatal , and there are some solutions. In particular, when elected to use Ibatis DataAccess as a DAO framework, we can use NHibernate, ADO.NET and DataMapper (IbatisNet core components), that will minimize the risk, and the entire system framework is more reasonable. In addition, the use of Ibatis can unify the coding style , to save development costs , we will not waste their energy to paging connection pools primary key generation and other places , you can focus on business components of the writing . In summary: Many times we have to develop their own framework and the choice of third-party frameworks and the choice of what kind of framework for comprehensive consideration. Consideration of the criteria is of course the current situation of the project and we hope to achieve a balance of purpose. Ibatis only encapsulates the data access layer, for us to do part of the object-relational mapping. But the cost is that we must write xml configuration files, as opposed to Hibernate we have to write a lot of sql. Hibernate through the tool directly from the database schema to generate entity classes and basic configuration files, and in most cases do not need us to write sql, will be greater to improve development efficiency. But these also have a lot of limitations, especially on the environment of the higher requirements (database design, object design, team collaboration , etc.). I personally feel that Ibatis on the project is more meaningful is that it is small, flexible, scalable, encapsulated data access layer (transactions, caching, exceptions, logging), and provides a DAO framework support. The use of Ibatis we can do code and sql separation , as long as sql can solve the problem , Ibatis can help us solve easier , but also to make our project on a framework for a smaller dependency ( because Ibatis is non-intrusive ). This will greatly reduce the project risk , reduce the time to solve complex problems , so that the maintenance of the project becomes simple . Ibatis for application modification, debugging, expansion and maintenance will become easy and natural. Modification , we mainly modify the model on behalf of the entity object , xml configuration file in the sql, and/or configuration file ResultMap (many times it is not necessary). At the same time, the sql and code separation, we do not need in the code between the StringBuffer append method to find the need to modify the sql. configuration file sql facilitates our debugging and the review of the sql and reuse the sql later. Utilizing some frameworks upfront generally slows down development efficiency. Because we need to pay the cost of learning , many times , the use of frameworks need to write a lot of configuration files , in the use of not familiar with the development of slower; while using the framework tends to increase the amount of code to make the system , such as Model1 and Model2 model , development efficiency should be Model1 fast, four-tier architecture is certainly more than the amount of code in two layers. But for the middle and late development and maintenance will greatly improve efficiency. Utilize some of the more complete development frameworks and code generation tools, in the early stage will be greater to improve development efficiency, but in the late stage will often slow down the progress, and may become a maintenance nightmare. For example, torque generates entity classes and their corresponding sql, although it greatly improves the efficiency, but the burden of modification is greater. The ideal development approach is to use a simple framework combined with a simple code generation tool. The framework provides the basic services of the system and standardizes the development. On the one hand, the framework provides the development of a certain aspect of the development of basic support, such as data access layer, transactions, logging, utility classes, exceptions and so on. On the other hand, it also defines the pattern for development and defines the basic outline of the system. At the same time, some of the low-level code is generated through simple code generation tools. For example, entity classes are generated from the database schema through the tool. After these classes are generated we are free to modify them. Hibernate is very powerful, more complete ORM framework, but this is its advantages and disadvantages. Whether or not to adopt Hibernate3 for j2ee systems is a question that needs to be carefully evaluated. To Hibernate work well, the database design must be good. At the same time for complex data manipulation at the same time need to use sql, Hibernate3 for the direct use of sql support than Hibernate2 to be natural, which is acceptable. Hibernate is more complex, powerful and flexible, to use Hibernate is really not very simple, of course, the Spring Framework provides Hibernate encapsulation, so that the use of Hibernate has become a simple point. It can be said that Ibatis in any system is applicable, but may not be the best choice. But Ibatis provides ideas that we should carefully consider.
ibatis encapsulates the data access layer, and compared to hibernate, ibatis is semi-automatic, while hibernate is fully automatic.